1# ArkUI Subsystem LocalStorage Class ChangeLog
2
3## cl.LocalStorage.1 Return Type Change of the get API
4
5Changed the return type from **get\<T>(propName: string): T** to **get\<T>(propName: string): T | undefined**.
6
7**Change Impact**
8
9
10None
11
12## cl.LocalStorage.2 Mandatory/Optional Change of the newValue Parameter in setOrCreate
13**Change Impact**
14
15API declaration before change:
16```js
17setOrCreate<T>(propName: string, newValue?: T): boolean
18```
19API declaration after change:
20```js
21setOrCreate<T>(propName: string, newValue: T): boolean
22```
23The **newValue** parameter becomes mandatory.
24If it is not specified when an application calls the API, the build will fail after the SDK is replaced.
25
26**Adaptation Guide**
27
28```js
29let storage = new LocalStorage();
30storage.setOrCreate('propA', 'hello');
31```
32## cl.LocalStorage.3 link Parameter and Return Type Changes
33**Change Impact**
34
35API declaration before change:
36```js
37link<T>(propName: string, linkUser?: T, subscribersName?: string): T
38```
39API declaration after change:
40```js
41link<T>(propName: string): SubscribedAbstractProperty<T>
42```
431. The second and third parameters of the **link** API are reserved for internal use by the framework. Therefore, the API is changed to contain only one parameter.
442. The return type **T** is changed to **SubscribedAbstractProperty**.
45
46**Adaptation Guide**
47
48```js
49let storage = new LocalStorage({"PropA": "47"});
50let linA = storage.link("PropA");
51linA.set(50);
52```
53
54## cl.LocalStorage.4 setAndLink Parameter and Return Type Changes
55**Change Impact**
56
57API declaration before change:
58```js
59setAndLink<T>(propName: string, defaultValue: T, linkUser?: T, subscribersName?: string): T
60```
61API declaration after change:
62```js
63setAndLink<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T>
64```
651. The third and fourth parameters of the **setAndLink** API are reserved for internal use by the framework. Therefore, the API is changed to contain two parameters.
662. The return type **T** is changed to **SubscribedAbstractProperty**.
67
68**Adaptation Guide**
69
70```js
71let storage = new LocalStorage({"PropA": "47"});
72let linA = storage.setAndLink("PropA", "48")
73linA.set(50);
74```
75
76## cl.LocalStorage.5 prop Parameter and Return Type Changes
77**Change Impact**
78
79API declaration before change:
80```js
81prop<T>(propName: string, propUser?: T, subscribersName?: string): T
82```
83API declaration after change:
84```js
85prop<S>(propName: string): SubscribedAbstractProperty<S>
86```
871. The second and third parameters of the **prop** API are reserved for internal use by the framework. Therefore, the API is changed to contain only one parameter.
882. The return type **T** is changed to **SubscribedAbstractProperty**.
89
90**Adaptation Guide**
91
92```js
93let storage = new LocalStorage({"PropA": "47"});
94let propA = storage.prop("PropA");
95propA.set(51); // one-way sync
96```
97
98## cl.LocalStorage.6 setAndProp Parameter and Return Type Changes
99**Change Impact**
100
101API declaration before change:
102```js
103setAndProp<T>(propName: string, defaultValue: T, propUser?: T, subscribersName?: string): T
104```
105API declaration after change:
106```js
107setAndProp<S>(propName: string, defaultValue: S): SubscribedAbstractProperty<S>
108```
1091. The third and fourth parameters of the **setAndProp** API are reserved for internal use by the framework. Therefore, the API is changed to contain two parameters.
1102. The return type **T** is changed to **SubscribedAbstractProperty**.
111
112**Adaptation Guide**
113
114```js
115let storage = new LocalStorage({"PropA": "47"});
116let propA = storage.setAndProp("PropA", "48");
117propA.set(51); // one-way sync
118```
119