1e41f4b71Sopenharmony_ci# ArkUI Subsystem LocalStorage Class ChangeLog 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci## cl.LocalStorage.1 Return Type Change of the get API 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ciChanged the return type from **get\<T>(propName: string): T** to **get\<T>(propName: string): T | undefined**. 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ci**Change Impact** 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_ciNone 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci## cl.LocalStorage.2 Mandatory/Optional Change of the newValue Parameter in setOrCreate 13e41f4b71Sopenharmony_ci**Change Impact** 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ciAPI declaration before change: 16e41f4b71Sopenharmony_ci```js 17e41f4b71Sopenharmony_cisetOrCreate<T>(propName: string, newValue?: T): boolean 18e41f4b71Sopenharmony_ci``` 19e41f4b71Sopenharmony_ciAPI declaration after change: 20e41f4b71Sopenharmony_ci```js 21e41f4b71Sopenharmony_cisetOrCreate<T>(propName: string, newValue: T): boolean 22e41f4b71Sopenharmony_ci``` 23e41f4b71Sopenharmony_ciThe **newValue** parameter becomes mandatory. 24e41f4b71Sopenharmony_ciIf it is not specified when an application calls the API, the build will fail after the SDK is replaced. 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci**Adaptation Guide** 27e41f4b71Sopenharmony_ci 28e41f4b71Sopenharmony_ci```js 29e41f4b71Sopenharmony_cilet storage = new LocalStorage(); 30e41f4b71Sopenharmony_cistorage.setOrCreate('propA', 'hello'); 31e41f4b71Sopenharmony_ci``` 32e41f4b71Sopenharmony_ci## cl.LocalStorage.3 link Parameter and Return Type Changes 33e41f4b71Sopenharmony_ci**Change Impact** 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ciAPI declaration before change: 36e41f4b71Sopenharmony_ci```js 37e41f4b71Sopenharmony_cilink<T>(propName: string, linkUser?: T, subscribersName?: string): T 38e41f4b71Sopenharmony_ci``` 39e41f4b71Sopenharmony_ciAPI declaration after change: 40e41f4b71Sopenharmony_ci```js 41e41f4b71Sopenharmony_cilink<T>(propName: string): SubscribedAbstractProperty<T> 42e41f4b71Sopenharmony_ci``` 43e41f4b71Sopenharmony_ci1. 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. 44e41f4b71Sopenharmony_ci2. The return type **T** is changed to **SubscribedAbstractProperty**. 45e41f4b71Sopenharmony_ci 46e41f4b71Sopenharmony_ci**Adaptation Guide** 47e41f4b71Sopenharmony_ci 48e41f4b71Sopenharmony_ci```js 49e41f4b71Sopenharmony_cilet storage = new LocalStorage({"PropA": "47"}); 50e41f4b71Sopenharmony_cilet linA = storage.link("PropA"); 51e41f4b71Sopenharmony_cilinA.set(50); 52e41f4b71Sopenharmony_ci``` 53e41f4b71Sopenharmony_ci 54e41f4b71Sopenharmony_ci## cl.LocalStorage.4 setAndLink Parameter and Return Type Changes 55e41f4b71Sopenharmony_ci**Change Impact** 56e41f4b71Sopenharmony_ci 57e41f4b71Sopenharmony_ciAPI declaration before change: 58e41f4b71Sopenharmony_ci```js 59e41f4b71Sopenharmony_cisetAndLink<T>(propName: string, defaultValue: T, linkUser?: T, subscribersName?: string): T 60e41f4b71Sopenharmony_ci``` 61e41f4b71Sopenharmony_ciAPI declaration after change: 62e41f4b71Sopenharmony_ci```js 63e41f4b71Sopenharmony_cisetAndLink<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T> 64e41f4b71Sopenharmony_ci``` 65e41f4b71Sopenharmony_ci1. 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. 66e41f4b71Sopenharmony_ci2. The return type **T** is changed to **SubscribedAbstractProperty**. 67e41f4b71Sopenharmony_ci 68e41f4b71Sopenharmony_ci**Adaptation Guide** 69e41f4b71Sopenharmony_ci 70e41f4b71Sopenharmony_ci```js 71e41f4b71Sopenharmony_cilet storage = new LocalStorage({"PropA": "47"}); 72e41f4b71Sopenharmony_cilet linA = storage.setAndLink("PropA", "48") 73e41f4b71Sopenharmony_cilinA.set(50); 74e41f4b71Sopenharmony_ci``` 75e41f4b71Sopenharmony_ci 76e41f4b71Sopenharmony_ci## cl.LocalStorage.5 prop Parameter and Return Type Changes 77e41f4b71Sopenharmony_ci**Change Impact** 78e41f4b71Sopenharmony_ci 79e41f4b71Sopenharmony_ciAPI declaration before change: 80e41f4b71Sopenharmony_ci```js 81e41f4b71Sopenharmony_ciprop<T>(propName: string, propUser?: T, subscribersName?: string): T 82e41f4b71Sopenharmony_ci``` 83e41f4b71Sopenharmony_ciAPI declaration after change: 84e41f4b71Sopenharmony_ci```js 85e41f4b71Sopenharmony_ciprop<S>(propName: string): SubscribedAbstractProperty<S> 86e41f4b71Sopenharmony_ci``` 87e41f4b71Sopenharmony_ci1. 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. 88e41f4b71Sopenharmony_ci2. The return type **T** is changed to **SubscribedAbstractProperty**. 89e41f4b71Sopenharmony_ci 90e41f4b71Sopenharmony_ci**Adaptation Guide** 91e41f4b71Sopenharmony_ci 92e41f4b71Sopenharmony_ci```js 93e41f4b71Sopenharmony_cilet storage = new LocalStorage({"PropA": "47"}); 94e41f4b71Sopenharmony_cilet propA = storage.prop("PropA"); 95e41f4b71Sopenharmony_cipropA.set(51); // one-way sync 96e41f4b71Sopenharmony_ci``` 97e41f4b71Sopenharmony_ci 98e41f4b71Sopenharmony_ci## cl.LocalStorage.6 setAndProp Parameter and Return Type Changes 99e41f4b71Sopenharmony_ci**Change Impact** 100e41f4b71Sopenharmony_ci 101e41f4b71Sopenharmony_ciAPI declaration before change: 102e41f4b71Sopenharmony_ci```js 103e41f4b71Sopenharmony_cisetAndProp<T>(propName: string, defaultValue: T, propUser?: T, subscribersName?: string): T 104e41f4b71Sopenharmony_ci``` 105e41f4b71Sopenharmony_ciAPI declaration after change: 106e41f4b71Sopenharmony_ci```js 107e41f4b71Sopenharmony_cisetAndProp<S>(propName: string, defaultValue: S): SubscribedAbstractProperty<S> 108e41f4b71Sopenharmony_ci``` 109e41f4b71Sopenharmony_ci1. 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. 110e41f4b71Sopenharmony_ci2. The return type **T** is changed to **SubscribedAbstractProperty**. 111e41f4b71Sopenharmony_ci 112e41f4b71Sopenharmony_ci**Adaptation Guide** 113e41f4b71Sopenharmony_ci 114e41f4b71Sopenharmony_ci```js 115e41f4b71Sopenharmony_cilet storage = new LocalStorage({"PropA": "47"}); 116e41f4b71Sopenharmony_cilet propA = storage.setAndProp("PropA", "48"); 117e41f4b71Sopenharmony_cipropA.set(51); // one-way sync 118e41f4b71Sopenharmony_ci``` 119