161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2022-2023 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit ArkUI 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ci/** 2261847f8eSopenharmony_ci * AppStorage singleton is sub-class of see LocalStorage for 2361847f8eSopenharmony_ci * UI state of app-wide access and same life cycle as the app. 2461847f8eSopenharmony_ci * 2561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 2661847f8eSopenharmony_ci * @since 7 2761847f8eSopenharmony_ci */ 2861847f8eSopenharmony_ci/** 2961847f8eSopenharmony_ci * AppStorage singleton is sub-class of see LocalStorage for 3061847f8eSopenharmony_ci * UI state of app-wide access and same life cycle as the app. 3161847f8eSopenharmony_ci * 3261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 3361847f8eSopenharmony_ci * @crossplatform 3461847f8eSopenharmony_ci * @since 10 3561847f8eSopenharmony_ci */ 3661847f8eSopenharmony_ci/** 3761847f8eSopenharmony_ci * AppStorage singleton is sub-class of see LocalStorage for 3861847f8eSopenharmony_ci * UI state of app-wide access and same life cycle as the app. 3961847f8eSopenharmony_ci * 4061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 4161847f8eSopenharmony_ci * @crossplatform 4261847f8eSopenharmony_ci * @atomicservice 4361847f8eSopenharmony_ci * @since 11 4461847f8eSopenharmony_ci */ 4561847f8eSopenharmony_cideclare class AppStorage { 4661847f8eSopenharmony_ci /** 4761847f8eSopenharmony_ci * Obtain a handler or an alias to AppStorage property with given name. 4861847f8eSopenharmony_ci * 4961847f8eSopenharmony_ci * @param { string } propName AppStorage property name 5061847f8eSopenharmony_ci * @returns { AbstractProperty<T> | undefined } AbstractProperty object if property with given name exists 5161847f8eSopenharmony_ci * return undefined otherwise 5261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 5361847f8eSopenharmony_ci * @crossplatform 5461847f8eSopenharmony_ci * @atomicservice 5561847f8eSopenharmony_ci * @since 12 5661847f8eSopenharmony_ci */ 5761847f8eSopenharmony_ci static ref<T>(propName: string): AbstractProperty<T> | undefined; 5861847f8eSopenharmony_ci 5961847f8eSopenharmony_ci /** 6061847f8eSopenharmony_ci * Obtain a handler or an alias to AppStorage property with given name. 6161847f8eSopenharmony_ci * 6261847f8eSopenharmony_ci * If property does not exist in AppStorage, create it with given default value. 6361847f8eSopenharmony_ci * 6461847f8eSopenharmony_ci * @param { string } propName AppStorage property name 6561847f8eSopenharmony_ci * @param { T } defaultValue If property does not exist in AppStorage, 6661847f8eSopenharmony_ci * create it with given default value. 6761847f8eSopenharmony_ci * @returns { AbstractProperty<T> } AbstractProperty object 6861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 6961847f8eSopenharmony_ci * @crossplatform 7061847f8eSopenharmony_ci * @atomicservice 7161847f8eSopenharmony_ci * @since 12 7261847f8eSopenharmony_ci */ 7361847f8eSopenharmony_ci static setAndRef<T>(propName: string, defaultValue: T): AbstractProperty<T>; 7461847f8eSopenharmony_ci 7561847f8eSopenharmony_ci /** 7661847f8eSopenharmony_ci * Called when a link is set. 7761847f8eSopenharmony_ci * Create and return a two-way sync ("link") to named property 7861847f8eSopenharmony_ci * 7961847f8eSopenharmony_ci * @param { string } propName 8061847f8eSopenharmony_ci * @returns { any } 8161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 8261847f8eSopenharmony_ci * @since 7 8361847f8eSopenharmony_ci * @deprecated since 10 8461847f8eSopenharmony_ci * @useinstead AppStorage#link 8561847f8eSopenharmony_ci */ 8661847f8eSopenharmony_ci static Link(propName: string): any; 8761847f8eSopenharmony_ci 8861847f8eSopenharmony_ci /** 8961847f8eSopenharmony_ci * Create and return a two-way sync ("link") to named property 9061847f8eSopenharmony_ci * Same as @see LocalStorage.link() 9161847f8eSopenharmony_ci * 9261847f8eSopenharmony_ci * @param { string } propName - name of source property in AppStorage 9361847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<T> } instance of SubscribedAbstractProperty<T> 9461847f8eSopenharmony_ci * return 'undefined' if named property does not already exist in AppStorage 9561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 9661847f8eSopenharmony_ci * @crossplatform 9761847f8eSopenharmony_ci * @since 10 9861847f8eSopenharmony_ci */ 9961847f8eSopenharmony_ci /** 10061847f8eSopenharmony_ci * Create and return a two-way sync ("link") to named property 10161847f8eSopenharmony_ci * Same as @see LocalStorage.link() 10261847f8eSopenharmony_ci * 10361847f8eSopenharmony_ci * @param { string } propName - name of source property in AppStorage 10461847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<T> } instance of SubscribedAbstractProperty<T> 10561847f8eSopenharmony_ci * return 'undefined' if named property does not already exist in AppStorage 10661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 10761847f8eSopenharmony_ci * @crossplatform 10861847f8eSopenharmony_ci * @atomicservice 10961847f8eSopenharmony_ci * @since 11 11061847f8eSopenharmony_ci */ 11161847f8eSopenharmony_ci static link<T>(propName: string): SubscribedAbstractProperty<T>; 11261847f8eSopenharmony_ci 11361847f8eSopenharmony_ci /** 11461847f8eSopenharmony_ci * Like see @Link(), but will create and initialize a new source property in AppStorage if missing 11561847f8eSopenharmony_ci * Same as see LocalStorage.setAndLink() 11661847f8eSopenharmony_ci * 11761847f8eSopenharmony_ci * @param { string } propName 11861847f8eSopenharmony_ci * @param { T } defaultValue 11961847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<T> } 12061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 12161847f8eSopenharmony_ci * @since 7 12261847f8eSopenharmony_ci * @deprecated since 10 12361847f8eSopenharmony_ci * @useinstead AppStorage#setAndLink 12461847f8eSopenharmony_ci * @see setAndLink 12561847f8eSopenharmony_ci */ 12661847f8eSopenharmony_ci static SetAndLink<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T>; 12761847f8eSopenharmony_ci 12861847f8eSopenharmony_ci /** 12961847f8eSopenharmony_ci * Like see @link(), but will create and initialize a new source property in AppStorage if missing 13061847f8eSopenharmony_ci * Same as see LocalStorage.setAndLink() 13161847f8eSopenharmony_ci * 13261847f8eSopenharmony_ci * @param { string } propName - name of source property in AppStorage 13361847f8eSopenharmony_ci * @param { T } defaultValue - value to be used for initializing if new creating new property in AppStorage 13461847f8eSopenharmony_ci * default value must be of type T, must not be 'undefined' or 'null'. 13561847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<T> } instance of SubscribedAbstractProperty<T> 13661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 13761847f8eSopenharmony_ci * @crossplatform 13861847f8eSopenharmony_ci * @since 10 13961847f8eSopenharmony_ci */ 14061847f8eSopenharmony_ci /** 14161847f8eSopenharmony_ci * Like see @link(), but will create and initialize a new source property in AppStorage if missing 14261847f8eSopenharmony_ci * Same as see LocalStorage.setAndLink() 14361847f8eSopenharmony_ci * 14461847f8eSopenharmony_ci * @param { string } propName - name of source property in AppStorage 14561847f8eSopenharmony_ci * @param { T } defaultValue - value to be used for initializing if new creating new property in AppStorage 14661847f8eSopenharmony_ci * default value must be of type T, must not be 'undefined' or 'null'. 14761847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<T> } instance of SubscribedAbstractProperty<T> 14861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 14961847f8eSopenharmony_ci * @crossplatform 15061847f8eSopenharmony_ci * @atomicservice 15161847f8eSopenharmony_ci * @since 11 15261847f8eSopenharmony_ci */ 15361847f8eSopenharmony_ci /** 15461847f8eSopenharmony_ci * Like see @link(), but will create and initialize a new source property in AppStorage if missing 15561847f8eSopenharmony_ci * Same as see LocalStorage.setAndLink() 15661847f8eSopenharmony_ci * 15761847f8eSopenharmony_ci * @param { string } propName - name of source property in AppStorage 15861847f8eSopenharmony_ci * @param { T } defaultValue - value to be used for initializing new property in AppStorage 15961847f8eSopenharmony_ci * default value must be of type T, can be undefined or null. 16061847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<T> } instance of SubscribedAbstractProperty<T> 16161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 16261847f8eSopenharmony_ci * @crossplatform 16361847f8eSopenharmony_ci * @atomicservice 16461847f8eSopenharmony_ci * @since 12 16561847f8eSopenharmony_ci */ 16661847f8eSopenharmony_ci static setAndLink<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T>; 16761847f8eSopenharmony_ci 16861847f8eSopenharmony_ci /** 16961847f8eSopenharmony_ci * Called when a property is set. 17061847f8eSopenharmony_ci * Create and return a one-way sync ('prop') to named property 17161847f8eSopenharmony_ci * 17261847f8eSopenharmony_ci * @param { string } propName 17361847f8eSopenharmony_ci * @returns { any } 17461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 17561847f8eSopenharmony_ci * @since 7 17661847f8eSopenharmony_ci * @deprecated since 10 17761847f8eSopenharmony_ci * @useinstead AppStorage#prop 17861847f8eSopenharmony_ci */ 17961847f8eSopenharmony_ci static Prop(propName: string): any; 18061847f8eSopenharmony_ci 18161847f8eSopenharmony_ci /** 18261847f8eSopenharmony_ci * Create and return a one-way sync ('prop') to named property 18361847f8eSopenharmony_ci * Same as @see LocalStorage.prop() 18461847f8eSopenharmony_ci * 18561847f8eSopenharmony_ci * @param { string } propName - name of source property in AppStorage 18661847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<T> } instance of SubscribedAbstractProperty<T> 18761847f8eSopenharmony_ci * return undefined if named property does not already exist in AppStorage. 18861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 18961847f8eSopenharmony_ci * @crossplatform 19061847f8eSopenharmony_ci * @since 10 19161847f8eSopenharmony_ci */ 19261847f8eSopenharmony_ci /** 19361847f8eSopenharmony_ci * Create and return a one-way sync ('prop') to named property 19461847f8eSopenharmony_ci * Same as @see LocalStorage.prop() 19561847f8eSopenharmony_ci * 19661847f8eSopenharmony_ci * @param { string } propName - name of source property in AppStorage 19761847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<T> } instance of SubscribedAbstractProperty<T> 19861847f8eSopenharmony_ci * return undefined if named property does not already exist in AppStorage. 19961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 20061847f8eSopenharmony_ci * @crossplatform 20161847f8eSopenharmony_ci * @atomicservice 20261847f8eSopenharmony_ci * @since 11 20361847f8eSopenharmony_ci */ 20461847f8eSopenharmony_ci static prop<T>(propName: string): SubscribedAbstractProperty<T>; 20561847f8eSopenharmony_ci 20661847f8eSopenharmony_ci /** 20761847f8eSopenharmony_ci * Like see Prop(), will create and initialize a new source property in AppStorage if missing 20861847f8eSopenharmony_ci * Same as see LocalStorage.setAndProp() 20961847f8eSopenharmony_ci * 21061847f8eSopenharmony_ci * @param { string } propName 21161847f8eSopenharmony_ci * @param { S } defaultValue 21261847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<S> } 21361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 21461847f8eSopenharmony_ci * @since 7 21561847f8eSopenharmony_ci * @deprecated since 10 21661847f8eSopenharmony_ci * @useinstead AppStorage#setAndProp 21761847f8eSopenharmony_ci * @see setAndProp 21861847f8eSopenharmony_ci */ 21961847f8eSopenharmony_ci static SetAndProp<S>(propName: string, defaultValue: S): SubscribedAbstractProperty<S>; 22061847f8eSopenharmony_ci 22161847f8eSopenharmony_ci /** 22261847f8eSopenharmony_ci * 22361847f8eSopenharmony_ci * Like @see prop(), will create and initialize a new source property in AppStorage if missing 22461847f8eSopenharmony_ci * Same as see LocalStorage.setAndProp() 22561847f8eSopenharmony_ci * 22661847f8eSopenharmony_ci * @param { string } propName - name of source property in AppStorage 22761847f8eSopenharmony_ci * @param { T } defaultValue - value to be used for initializing if new creating new property in AppStorage. 22861847f8eSopenharmony_ci * default value must be of type T, must not be undefined or null. 22961847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<T> } instance of SubscribedAbstractProperty<T> 23061847f8eSopenharmony_ci * return undefined if named property does not already exist in AppStorage. 23161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 23261847f8eSopenharmony_ci * @crossplatform 23361847f8eSopenharmony_ci * @since 10 23461847f8eSopenharmony_ci */ 23561847f8eSopenharmony_ci /** 23661847f8eSopenharmony_ci * 23761847f8eSopenharmony_ci * Like @see prop(), will create and initialize a new source property in AppStorage if missing 23861847f8eSopenharmony_ci * Same as see LocalStorage.setAndProp() 23961847f8eSopenharmony_ci * 24061847f8eSopenharmony_ci * @param { string } propName - name of source property in AppStorage 24161847f8eSopenharmony_ci * @param { T } defaultValue - value to be used for initializing if new creating new property in AppStorage. 24261847f8eSopenharmony_ci * default value must be of type T, must not be undefined or null. 24361847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<T> } instance of SubscribedAbstractProperty<T> 24461847f8eSopenharmony_ci * return undefined if named property does not already exist in AppStorage. 24561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 24661847f8eSopenharmony_ci * @crossplatform 24761847f8eSopenharmony_ci * @atomicservice 24861847f8eSopenharmony_ci * @since 11 24961847f8eSopenharmony_ci */ 25061847f8eSopenharmony_ci /** 25161847f8eSopenharmony_ci * 25261847f8eSopenharmony_ci * Like @see prop(), will create and initialize a new source property in AppStorage if missing 25361847f8eSopenharmony_ci * Same as see LocalStorage.setAndProp() 25461847f8eSopenharmony_ci * 25561847f8eSopenharmony_ci * @param { string } propName - name of source property in AppStorage 25661847f8eSopenharmony_ci * @param { T } defaultValue - value to be used for initializing new property in AppStorage. 25761847f8eSopenharmony_ci * default value must be of type T, can be undefined or null. 25861847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<T> } instance of SubscribedAbstractProperty<T> 25961847f8eSopenharmony_ci * return undefined if named property does not exist in AppStorage. 26061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 26161847f8eSopenharmony_ci * @crossplatform 26261847f8eSopenharmony_ci * @atomicservice 26361847f8eSopenharmony_ci * @since 12 26461847f8eSopenharmony_ci */ 26561847f8eSopenharmony_ci static setAndProp<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T>; 26661847f8eSopenharmony_ci 26761847f8eSopenharmony_ci /** 26861847f8eSopenharmony_ci * Checks if AppStorage has a property with given name 26961847f8eSopenharmony_ci * returns true if property with given name exists 27061847f8eSopenharmony_ci * same as ES6 Map.prototype.has() 27161847f8eSopenharmony_ci * Same as see LocalStorage.has() 27261847f8eSopenharmony_ci * 27361847f8eSopenharmony_ci * @param { string } propName 27461847f8eSopenharmony_ci * @returns { boolean } 27561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 27661847f8eSopenharmony_ci * @since 7 27761847f8eSopenharmony_ci * @deprecated since 10 27861847f8eSopenharmony_ci * @useinstead AppStorage#has 27961847f8eSopenharmony_ci * @see has 28061847f8eSopenharmony_ci */ 28161847f8eSopenharmony_ci static Has(propName: string): boolean; 28261847f8eSopenharmony_ci 28361847f8eSopenharmony_ci /** 28461847f8eSopenharmony_ci * Checks if AppStorage has a property with given name 28561847f8eSopenharmony_ci * returns true if property with given name exists 28661847f8eSopenharmony_ci * same as ES6 Map.prototype.has() 28761847f8eSopenharmony_ci * Same as see LocalStorage.has() 28861847f8eSopenharmony_ci * 28961847f8eSopenharmony_ci * @param { string } propName - searched property 29061847f8eSopenharmony_ci * @returns { boolean } true if property with such name exists in AppStorage 29161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 29261847f8eSopenharmony_ci * @crossplatform 29361847f8eSopenharmony_ci * @since 10 29461847f8eSopenharmony_ci */ 29561847f8eSopenharmony_ci /** 29661847f8eSopenharmony_ci * Checks if AppStorage has a property with given name 29761847f8eSopenharmony_ci * returns true if property with given name exists 29861847f8eSopenharmony_ci * same as ES6 Map.prototype.has() 29961847f8eSopenharmony_ci * Same as see LocalStorage.has() 30061847f8eSopenharmony_ci * 30161847f8eSopenharmony_ci * @param { string } propName - searched property 30261847f8eSopenharmony_ci * @returns { boolean } true if property with such name exists in AppStorage 30361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 30461847f8eSopenharmony_ci * @crossplatform 30561847f8eSopenharmony_ci * @atomicservice 30661847f8eSopenharmony_ci * @since 11 30761847f8eSopenharmony_ci */ 30861847f8eSopenharmony_ci static has(propName: string): boolean; 30961847f8eSopenharmony_ci 31061847f8eSopenharmony_ci /** 31161847f8eSopenharmony_ci * Same as see LocalStorage.get() 31261847f8eSopenharmony_ci * Obtain the value of property with given name, returns undefined if the property does not exist in AppStorage. 31361847f8eSopenharmony_ci * @param { string } propName 31461847f8eSopenharmony_ci * @returns { T | undefined } 31561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 31661847f8eSopenharmony_ci * @since 7 31761847f8eSopenharmony_ci * @deprecated since 10 31861847f8eSopenharmony_ci * @useinstead AppStorage#get 31961847f8eSopenharmony_ci * @see get 32061847f8eSopenharmony_ci */ 32161847f8eSopenharmony_ci static Get<T>(propName: string): T | undefined; 32261847f8eSopenharmony_ci 32361847f8eSopenharmony_ci /** 32461847f8eSopenharmony_ci * Same as see LocalStorage.get() 32561847f8eSopenharmony_ci * Obtain the value of property with given name, returns undefined if the property does not exist in AppStorage. 32661847f8eSopenharmony_ci * 32761847f8eSopenharmony_ci * @param { string } propName 32861847f8eSopenharmony_ci * @returns { T | undefined } property value of type T if found or undefined 32961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 33061847f8eSopenharmony_ci * @crossplatform 33161847f8eSopenharmony_ci * @since 10 33261847f8eSopenharmony_ci */ 33361847f8eSopenharmony_ci /** 33461847f8eSopenharmony_ci * Same as see LocalStorage.get() 33561847f8eSopenharmony_ci * Obtain the value of property with given name, returns undefined if the property does not exist in AppStorage. 33661847f8eSopenharmony_ci * 33761847f8eSopenharmony_ci * @param { string } propName 33861847f8eSopenharmony_ci * @returns { T | undefined } property value of type T if found or undefined 33961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 34061847f8eSopenharmony_ci * @crossplatform 34161847f8eSopenharmony_ci * @atomicservice 34261847f8eSopenharmony_ci * @since 11 34361847f8eSopenharmony_ci */ 34461847f8eSopenharmony_ci static get<T>(propName: string): T | undefined; 34561847f8eSopenharmony_ci 34661847f8eSopenharmony_ci /** 34761847f8eSopenharmony_ci * Set value of given property in AppStorage 34861847f8eSopenharmony_ci * Method sets nothing and returns false if property with this name does not exist 34961847f8eSopenharmony_ci * or if newValue is `undefined` or `null`. 35061847f8eSopenharmony_ci * Same as see LocalStorage.set() 35161847f8eSopenharmony_ci * 35261847f8eSopenharmony_ci * @param { string } propName 35361847f8eSopenharmony_ci * @param { T } newValue 35461847f8eSopenharmony_ci * @returns { boolean } 35561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 35661847f8eSopenharmony_ci * @since 7 35761847f8eSopenharmony_ci * @deprecated since 10 35861847f8eSopenharmony_ci * @useinstead AppStorage#set 35961847f8eSopenharmony_ci * @see set 36061847f8eSopenharmony_ci */ 36161847f8eSopenharmony_ci static Set<T>(propName: string, newValue: T): boolean; 36261847f8eSopenharmony_ci 36361847f8eSopenharmony_ci /** 36461847f8eSopenharmony_ci * Set value of given property in AppStorage 36561847f8eSopenharmony_ci * Method sets nothing and returns false if property with this name does not exist 36661847f8eSopenharmony_ci * or if newValue is `undefined` or `null`. 36761847f8eSopenharmony_ci * Same as see LocalStorage.set() 36861847f8eSopenharmony_ci * 36961847f8eSopenharmony_ci * @param { string } propName 37061847f8eSopenharmony_ci * @param { T } newValue - must be of type T and must not be undefined or null 37161847f8eSopenharmony_ci * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false 37261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 37361847f8eSopenharmony_ci * @crossplatform 37461847f8eSopenharmony_ci * @since 10 37561847f8eSopenharmony_ci */ 37661847f8eSopenharmony_ci /** 37761847f8eSopenharmony_ci * Set value of given property in AppStorage 37861847f8eSopenharmony_ci * Method sets nothing and returns false if property with this name does not exist 37961847f8eSopenharmony_ci * or if newValue is `undefined` or `null`. 38061847f8eSopenharmony_ci * Same as see LocalStorage.set() 38161847f8eSopenharmony_ci * 38261847f8eSopenharmony_ci * @param { string } propName 38361847f8eSopenharmony_ci * @param { T } newValue - must be of type T and must not be undefined or null 38461847f8eSopenharmony_ci * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false 38561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 38661847f8eSopenharmony_ci * @crossplatform 38761847f8eSopenharmony_ci * @atomicservice 38861847f8eSopenharmony_ci * @since 11 38961847f8eSopenharmony_ci */ 39061847f8eSopenharmony_ci /** 39161847f8eSopenharmony_ci * Set value of given property in AppStorage 39261847f8eSopenharmony_ci * Method sets nothing and returns false if property with this name does not exist in AppStorage 39361847f8eSopenharmony_ci * newValue can be undefined or null from API 12. 39461847f8eSopenharmony_ci * Same as see LocalStorage.set() 39561847f8eSopenharmony_ci * 39661847f8eSopenharmony_ci * @param { string } propName 39761847f8eSopenharmony_ci * @param { T } newValue - must be of type T, can be undefined or null 39861847f8eSopenharmony_ci * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false 39961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 40061847f8eSopenharmony_ci * @crossplatform 40161847f8eSopenharmony_ci * @atomicservice 40261847f8eSopenharmony_ci * @since 12 40361847f8eSopenharmony_ci */ 40461847f8eSopenharmony_ci static set<T>(propName: string, newValue: T): boolean; 40561847f8eSopenharmony_ci 40661847f8eSopenharmony_ci /** 40761847f8eSopenharmony_ci * Set value of given property, if it exists, see set() . 40861847f8eSopenharmony_ci * Add property if no property with given name in AppStorage,. yet, and initialize with given value. 40961847f8eSopenharmony_ci * Do nothing if newValue is undefined or null 41061847f8eSopenharmony_ci * see LocalStorage.setOrCreate() 41161847f8eSopenharmony_ci * 41261847f8eSopenharmony_ci * @param { string } propName 41361847f8eSopenharmony_ci * @param { T } newValue 41461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 41561847f8eSopenharmony_ci * @since 7 41661847f8eSopenharmony_ci * @deprecated since 10 41761847f8eSopenharmony_ci * @useinstead AppStorage#setOrCreate 41861847f8eSopenharmony_ci * @see setOrCreate 41961847f8eSopenharmony_ci */ 42061847f8eSopenharmony_ci static SetOrCreate<T>(propName: string, newValue: T): void; 42161847f8eSopenharmony_ci 42261847f8eSopenharmony_ci /** 42361847f8eSopenharmony_ci * Set value of given property, if it exists, see set() . 42461847f8eSopenharmony_ci * Add property if no property with given name in AppStorage,. yet, and initialize with given value. 42561847f8eSopenharmony_ci * Do nothing if newValue is undefined or null 42661847f8eSopenharmony_ci * see LocalStorage.setOrCreate() 42761847f8eSopenharmony_ci * 42861847f8eSopenharmony_ci * @param { string } propName 42961847f8eSopenharmony_ci * @param { T } newValue - must be of type T and must not be undefined or null 43061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 43161847f8eSopenharmony_ci * @crossplatform 43261847f8eSopenharmony_ci * @since 10 43361847f8eSopenharmony_ci */ 43461847f8eSopenharmony_ci /** 43561847f8eSopenharmony_ci * Set value of given property, if it exists, see set() . 43661847f8eSopenharmony_ci * Add property if no property with given name in AppStorage,. yet, and initialize with given value. 43761847f8eSopenharmony_ci * Do nothing if newValue is undefined or null 43861847f8eSopenharmony_ci * see LocalStorage.setOrCreate() 43961847f8eSopenharmony_ci * 44061847f8eSopenharmony_ci * @param { string } propName 44161847f8eSopenharmony_ci * @param { T } newValue - must be of type T and must not be undefined or null 44261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 44361847f8eSopenharmony_ci * @crossplatform 44461847f8eSopenharmony_ci * @atomicservice 44561847f8eSopenharmony_ci * @since 11 44661847f8eSopenharmony_ci */ 44761847f8eSopenharmony_ci /** 44861847f8eSopenharmony_ci * Set value of given property, if it exists, see set() . 44961847f8eSopenharmony_ci * Add property if no property with given name in AppStorage, and initialize with given value. 45061847f8eSopenharmony_ci * newValue can be undefined or null from API 12 45161847f8eSopenharmony_ci * see LocalStorage.setOrCreate() 45261847f8eSopenharmony_ci * 45361847f8eSopenharmony_ci * @param { string } propName 45461847f8eSopenharmony_ci * @param { T } newValue - must be of type T, can be undefined or null 45561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 45661847f8eSopenharmony_ci * @crossplatform 45761847f8eSopenharmony_ci * @atomicservice 45861847f8eSopenharmony_ci * @since 12 45961847f8eSopenharmony_ci */ 46061847f8eSopenharmony_ci static setOrCreate<T>(propName: string, newValue: T): void; 46161847f8eSopenharmony_ci 46261847f8eSopenharmony_ci /** 46361847f8eSopenharmony_ci * Delete property with given name from AppStorage 46461847f8eSopenharmony_ci * Use with caution: 46561847f8eSopenharmony_ci * Before deleting a prop from AppStorage all its subscribers need to 46661847f8eSopenharmony_ci * unsubscribe from the property. 46761847f8eSopenharmony_ci * This method fails and returns false if given property still has subscribers 46861847f8eSopenharmony_ci * Another reason for failing is unknown property name. 46961847f8eSopenharmony_ci * Developer advise: 47061847f8eSopenharmony_ci * Subscribers to a property in AppStorage are created with see link(), see prop() 47161847f8eSopenharmony_ci * and also via @StorageLink and @StorageProp state variable decorators. 47261847f8eSopenharmony_ci * That means as long as their is a @Component instance that uses such decorated variable 47361847f8eSopenharmony_ci * or a sync relationship with a SubscribedAbstractProperty variable the property can not 47461847f8eSopenharmony_ci * (and also should not!) be deleted from AppStorage. 47561847f8eSopenharmony_ci * Same as see LocalStorage.delete() 47661847f8eSopenharmony_ci * 47761847f8eSopenharmony_ci * @param { string } propName 47861847f8eSopenharmony_ci * @returns { boolean } 47961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 48061847f8eSopenharmony_ci * @since 7 48161847f8eSopenharmony_ci * @deprecated since 10 48261847f8eSopenharmony_ci * @useinstead AppStorage#delete 48361847f8eSopenharmony_ci * @see delete 48461847f8eSopenharmony_ci */ 48561847f8eSopenharmony_ci static Delete(propName: string): boolean; 48661847f8eSopenharmony_ci 48761847f8eSopenharmony_ci /** 48861847f8eSopenharmony_ci * Delete property with given name from AppStorage 48961847f8eSopenharmony_ci * Use with caution: 49061847f8eSopenharmony_ci * Before deleting a prop from AppStorage all its subscribers need to 49161847f8eSopenharmony_ci * unsubscribe from the property. 49261847f8eSopenharmony_ci * This method fails and returns false if given property still has subscribers 49361847f8eSopenharmony_ci * Another reason for failing is unknown property name. 49461847f8eSopenharmony_ci * Developer advise: 49561847f8eSopenharmony_ci * Subscribers to a property in AppStorage are created with see link(), see prop() 49661847f8eSopenharmony_ci * and also via @StorageLink and @StorageProp state variable decorators. 49761847f8eSopenharmony_ci * That means as long as their is a @Component instance that uses such decorated variable 49861847f8eSopenharmony_ci * or a sync relationship with a SubscribedAbstractProperty variable the property can not 49961847f8eSopenharmony_ci * (and also should not!) be deleted from AppStorage. 50061847f8eSopenharmony_ci * Same as see LocalStorage.delete() 50161847f8eSopenharmony_ci * 50261847f8eSopenharmony_ci * @param { string } propName 50361847f8eSopenharmony_ci * @returns { boolean } false if method failed 50461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 50561847f8eSopenharmony_ci * @crossplatform 50661847f8eSopenharmony_ci * @since 10 50761847f8eSopenharmony_ci */ 50861847f8eSopenharmony_ci /** 50961847f8eSopenharmony_ci * Delete property with given name from AppStorage 51061847f8eSopenharmony_ci * Use with caution: 51161847f8eSopenharmony_ci * Before deleting a prop from AppStorage all its subscribers need to 51261847f8eSopenharmony_ci * unsubscribe from the property. 51361847f8eSopenharmony_ci * This method fails and returns false if given property still has subscribers 51461847f8eSopenharmony_ci * Another reason for failing is unknown property name. 51561847f8eSopenharmony_ci * Developer advise: 51661847f8eSopenharmony_ci * Subscribers to a property in AppStorage are created with see link(), see prop() 51761847f8eSopenharmony_ci * and also via @StorageLink and @StorageProp state variable decorators. 51861847f8eSopenharmony_ci * That means as long as their is a @Component instance that uses such decorated variable 51961847f8eSopenharmony_ci * or a sync relationship with a SubscribedAbstractProperty variable the property can not 52061847f8eSopenharmony_ci * (and also should not!) be deleted from AppStorage. 52161847f8eSopenharmony_ci * Same as see LocalStorage.delete() 52261847f8eSopenharmony_ci * 52361847f8eSopenharmony_ci * @param { string } propName 52461847f8eSopenharmony_ci * @returns { boolean } false if method failed 52561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 52661847f8eSopenharmony_ci * @crossplatform 52761847f8eSopenharmony_ci * @atomicservice 52861847f8eSopenharmony_ci * @since 11 52961847f8eSopenharmony_ci */ 53061847f8eSopenharmony_ci static delete(propName: string): boolean; 53161847f8eSopenharmony_ci 53261847f8eSopenharmony_ci /** 53361847f8eSopenharmony_ci * Provide names of all properties in AppStorage 53461847f8eSopenharmony_ci * same as ES6 Map.prototype.keys() 53561847f8eSopenharmony_ci * Same as see LocalStorage.keys() 53661847f8eSopenharmony_ci * 53761847f8eSopenharmony_ci * @returns { IterableIterator<string> } 53861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 53961847f8eSopenharmony_ci * @since 7 54061847f8eSopenharmony_ci * @deprecated since 10 54161847f8eSopenharmony_ci * @useinstead AppStorage#keys 54261847f8eSopenharmony_ci * @see keys 54361847f8eSopenharmony_ci */ 54461847f8eSopenharmony_ci static Keys(): IterableIterator<string>; 54561847f8eSopenharmony_ci 54661847f8eSopenharmony_ci /** 54761847f8eSopenharmony_ci * Provide names of all properties in AppStorage 54861847f8eSopenharmony_ci * same as ES6 Map.prototype.keys() 54961847f8eSopenharmony_ci * Same as see LocalStorage.keys() 55061847f8eSopenharmony_ci * 55161847f8eSopenharmony_ci * @returns { IterableIterator<string> } return a Map Iterator 55261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 55361847f8eSopenharmony_ci * @crossplatform 55461847f8eSopenharmony_ci * @since 10 55561847f8eSopenharmony_ci */ 55661847f8eSopenharmony_ci /** 55761847f8eSopenharmony_ci * Provide names of all properties in AppStorage 55861847f8eSopenharmony_ci * same as ES6 Map.prototype.keys() 55961847f8eSopenharmony_ci * Same as see LocalStorage.keys() 56061847f8eSopenharmony_ci * 56161847f8eSopenharmony_ci * @returns { IterableIterator<string> } return a Map Iterator 56261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 56361847f8eSopenharmony_ci * @crossplatform 56461847f8eSopenharmony_ci * @atomicservice 56561847f8eSopenharmony_ci * @since 11 56661847f8eSopenharmony_ci */ 56761847f8eSopenharmony_ci static keys(): IterableIterator<string>; 56861847f8eSopenharmony_ci 56961847f8eSopenharmony_ci /** 57061847f8eSopenharmony_ci * Called when a cleanup occurs. 57161847f8eSopenharmony_ci * 57261847f8eSopenharmony_ci * @returns { boolean } 57361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 57461847f8eSopenharmony_ci * @since 7 57561847f8eSopenharmony_ci * @deprecated since 9 57661847f8eSopenharmony_ci * @useinstead AppStorage.Clear 57761847f8eSopenharmony_ci */ 57861847f8eSopenharmony_ci static staticClear(): boolean; 57961847f8eSopenharmony_ci 58061847f8eSopenharmony_ci /** 58161847f8eSopenharmony_ci * Delete all properties from the AppStorage. 58261847f8eSopenharmony_ci * Precondition is that there are no subscribers, see Delete(). 58361847f8eSopenharmony_ci * 58461847f8eSopenharmony_ci * @returns { boolean } 58561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 58661847f8eSopenharmony_ci * @since 9 58761847f8eSopenharmony_ci * @deprecated since 10 58861847f8eSopenharmony_ci * @useinstead AppStorage#clear 58961847f8eSopenharmony_ci * @see clear 59061847f8eSopenharmony_ci */ 59161847f8eSopenharmony_ci static Clear(): boolean; 59261847f8eSopenharmony_ci 59361847f8eSopenharmony_ci /** 59461847f8eSopenharmony_ci * Delete all properties from the AppStorage. 59561847f8eSopenharmony_ci * Precondition is that there are no subscribers, see Delete(). 59661847f8eSopenharmony_ci * 59761847f8eSopenharmony_ci * @returns { boolean } false and deletes no properties if there is any property 59861847f8eSopenharmony_ci * that still has subscribers. 59961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 60061847f8eSopenharmony_ci * @crossplatform 60161847f8eSopenharmony_ci * @since 10 60261847f8eSopenharmony_ci */ 60361847f8eSopenharmony_ci /** 60461847f8eSopenharmony_ci * Delete all properties from the AppStorage. 60561847f8eSopenharmony_ci * Precondition is that there are no subscribers, see Delete(). 60661847f8eSopenharmony_ci * 60761847f8eSopenharmony_ci * @returns { boolean } false and deletes no properties if there is any property 60861847f8eSopenharmony_ci * that still has subscribers. 60961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 61061847f8eSopenharmony_ci * @crossplatform 61161847f8eSopenharmony_ci * @atomicservice 61261847f8eSopenharmony_ci * @since 11 61361847f8eSopenharmony_ci */ 61461847f8eSopenharmony_ci static clear(): boolean; 61561847f8eSopenharmony_ci 61661847f8eSopenharmony_ci /** 61761847f8eSopenharmony_ci * Called when the data can be changed. 61861847f8eSopenharmony_ci * 61961847f8eSopenharmony_ci * @param { string } propName 62061847f8eSopenharmony_ci * @returns { boolean } 62161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 62261847f8eSopenharmony_ci * @since 7 62361847f8eSopenharmony_ci * @deprecated since 10 62461847f8eSopenharmony_ci */ 62561847f8eSopenharmony_ci static IsMutable(propName: string): boolean; 62661847f8eSopenharmony_ci 62761847f8eSopenharmony_ci /** 62861847f8eSopenharmony_ci * Method returns the number of properties currently in AppStorage 62961847f8eSopenharmony_ci * 63061847f8eSopenharmony_ci * @returns { number } 63161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 63261847f8eSopenharmony_ci * @since 7 63361847f8eSopenharmony_ci * @deprecated since 10 63461847f8eSopenharmony_ci * @useinstead AppStorage#size 63561847f8eSopenharmony_ci * @see size 63661847f8eSopenharmony_ci */ 63761847f8eSopenharmony_ci static Size(): number; 63861847f8eSopenharmony_ci 63961847f8eSopenharmony_ci /** 64061847f8eSopenharmony_ci * Method returns the number of properties currently in AppStorage 64161847f8eSopenharmony_ci * 64261847f8eSopenharmony_ci * @returns { number } Returns the number of properties currently in AppStorage 64361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 64461847f8eSopenharmony_ci * @crossplatform 64561847f8eSopenharmony_ci * @since 10 64661847f8eSopenharmony_ci */ 64761847f8eSopenharmony_ci /** 64861847f8eSopenharmony_ci * Method returns the number of properties currently in AppStorage 64961847f8eSopenharmony_ci * 65061847f8eSopenharmony_ci * @returns { number } Returns the number of properties currently in AppStorage 65161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 65261847f8eSopenharmony_ci * @crossplatform 65361847f8eSopenharmony_ci * @atomicservice 65461847f8eSopenharmony_ci * @since 11 65561847f8eSopenharmony_ci */ 65661847f8eSopenharmony_ci static size(): number; 65761847f8eSopenharmony_ci} 65861847f8eSopenharmony_ci 65961847f8eSopenharmony_ci/** 66061847f8eSopenharmony_ci * 66161847f8eSopenharmony_ci * AbstractProperty can be understood as a handler or an alias 66261847f8eSopenharmony_ci * to a property inside LocalStorage / AppStorage singleton 66361847f8eSopenharmony_ci * allows to read the value with @see get and to change the 66461847f8eSopenharmony_ci * value with @see set. 66561847f8eSopenharmony_ci * 66661847f8eSopenharmony_ci * Functions 66761847f8eSopenharmony_ci * reads the referenced AppStorage/LocalStorage property value with given name @see get() 66861847f8eSopenharmony_ci * write a new value to the AppStorage/LocalStorage property value @see set() 66961847f8eSopenharmony_ci * returns the referenced AppStorage/LocalStorage property name @see info() 67061847f8eSopenharmony_ci * 67161847f8eSopenharmony_ci * Use ref or setAndRef to obtain a AbstractProperty. 67261847f8eSopenharmony_ci * 67361847f8eSopenharmony_ci * @interface AbstractProperty<T> 67461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 67561847f8eSopenharmony_ci * @crossplatform 67661847f8eSopenharmony_ci * @atomicservice 67761847f8eSopenharmony_ci * @since 12 67861847f8eSopenharmony_ci */ 67961847f8eSopenharmony_cideclare interface AbstractProperty<T> { 68061847f8eSopenharmony_ci /** 68161847f8eSopenharmony_ci * reads value of the referenced AppStorage/LocalStorage property. 68261847f8eSopenharmony_ci * 68361847f8eSopenharmony_ci * @returns { T } value of the referenced AppStorage/LocalStorage property. 68461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 68561847f8eSopenharmony_ci * @crossplatform 68661847f8eSopenharmony_ci * @atomicservice 68761847f8eSopenharmony_ci * @since 12 68861847f8eSopenharmony_ci */ 68961847f8eSopenharmony_ci get(): T; 69061847f8eSopenharmony_ci 69161847f8eSopenharmony_ci /** 69261847f8eSopenharmony_ci * Set new value, must be of type T, can be 'undefined' or 'null'. 69361847f8eSopenharmony_ci * Updates the value of the referenced AppStorage/LocalStorage property. 69461847f8eSopenharmony_ci * 69561847f8eSopenharmony_ci * @param { T } newValue new value set to AppStorage/LocalStorage 69661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 69761847f8eSopenharmony_ci * @crossplatform 69861847f8eSopenharmony_ci * @atomicservice 69961847f8eSopenharmony_ci * @since 12 70061847f8eSopenharmony_ci */ 70161847f8eSopenharmony_ci set(newValue: T): void; 70261847f8eSopenharmony_ci 70361847f8eSopenharmony_ci /** 70461847f8eSopenharmony_ci * returns the name of the referenced property 70561847f8eSopenharmony_ci * 70661847f8eSopenharmony_ci * @returns { string } name of the referenced property 70761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 70861847f8eSopenharmony_ci * @crossplatform 70961847f8eSopenharmony_ci * @atomicservice 71061847f8eSopenharmony_ci * @since 12 71161847f8eSopenharmony_ci */ 71261847f8eSopenharmony_ci info(): string; 71361847f8eSopenharmony_ci} 71461847f8eSopenharmony_ci 71561847f8eSopenharmony_ci/** 71661847f8eSopenharmony_ci * Defines the subscribed abstract property. 71761847f8eSopenharmony_ci * 71861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 71961847f8eSopenharmony_ci * @systemapi 72061847f8eSopenharmony_ci * @since 7 72161847f8eSopenharmony_ci */ 72261847f8eSopenharmony_ci/** 72361847f8eSopenharmony_ci * SubscribedAbstractProperty<T> is the return value of 72461847f8eSopenharmony_ci * - AppStorage static functions Link(), Prop(), SetAndLink(), and SetAndProp() 72561847f8eSopenharmony_ci * - LocalStorage member methods link(), prop(), setAndLink(), and setAndProp() 72661847f8eSopenharmony_ci * 'T' can be boolean, string, number or custom class. 72761847f8eSopenharmony_ci * Main functions 72861847f8eSopenharmony_ci * see get() reads the linked AppStorage/LocalStorage property value, 72961847f8eSopenharmony_ci * see set(newValue) write a new value to the synched AppStorage/LocalStorage property 73061847f8eSopenharmony_ci * see aboutToBeDeleted() ends the sync relationship with the AppStorage/LocalStorage property 73161847f8eSopenharmony_ci * The app must call this function before the SubscribedAbstractProperty<T> object 73261847f8eSopenharmony_ci * goes out of scope. 73361847f8eSopenharmony_ci * 73461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 73561847f8eSopenharmony_ci * @form 73661847f8eSopenharmony_ci * @since 9 73761847f8eSopenharmony_ci */ 73861847f8eSopenharmony_ci/** 73961847f8eSopenharmony_ci * SubscribedAbstractProperty<T> is the return value of 74061847f8eSopenharmony_ci * - AppStorage static functions Link(), Prop(), SetAndLink(), and SetAndProp() 74161847f8eSopenharmony_ci * - LocalStorage member methods link(), prop(), setAndLink(), and setAndProp() 74261847f8eSopenharmony_ci * 'T' can be boolean, string, number or custom class. 74361847f8eSopenharmony_ci * Main functions 74461847f8eSopenharmony_ci * see get() reads the linked AppStorage/LocalStorage property value, 74561847f8eSopenharmony_ci * see set(newValue) write a new value to the synched AppStorage/LocalStorage property 74661847f8eSopenharmony_ci * see aboutToBeDeleted() ends the sync relationship with the AppStorage/LocalStorage property 74761847f8eSopenharmony_ci * The app must call this function before the SubscribedAbstractProperty<T> object 74861847f8eSopenharmony_ci * goes out of scope. 74961847f8eSopenharmony_ci * 75061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 75161847f8eSopenharmony_ci * @crossplatform 75261847f8eSopenharmony_ci * @form 75361847f8eSopenharmony_ci * @since 10 75461847f8eSopenharmony_ci */ 75561847f8eSopenharmony_ci/** 75661847f8eSopenharmony_ci * SubscribedAbstractProperty<T> is the return value of 75761847f8eSopenharmony_ci * - AppStorage static functions Link(), Prop(), SetAndLink(), and SetAndProp() 75861847f8eSopenharmony_ci * - LocalStorage member methods link(), prop(), setAndLink(), and setAndProp() 75961847f8eSopenharmony_ci * 'T' can be boolean, string, number or custom class. 76061847f8eSopenharmony_ci * Main functions 76161847f8eSopenharmony_ci * see get() reads the linked AppStorage/LocalStorage property value, 76261847f8eSopenharmony_ci * see set(newValue) write a new value to the synched AppStorage/LocalStorage property 76361847f8eSopenharmony_ci * see aboutToBeDeleted() ends the sync relationship with the AppStorage/LocalStorage property 76461847f8eSopenharmony_ci * The app must call this function before the SubscribedAbstractProperty<T> object 76561847f8eSopenharmony_ci * goes out of scope. 76661847f8eSopenharmony_ci * 76761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 76861847f8eSopenharmony_ci * @crossplatform 76961847f8eSopenharmony_ci * @form 77061847f8eSopenharmony_ci * @atomicservice 77161847f8eSopenharmony_ci * @since 11 77261847f8eSopenharmony_ci */ 77361847f8eSopenharmony_cideclare abstract class SubscribedAbstractProperty<T> { 77461847f8eSopenharmony_ci /** 77561847f8eSopenharmony_ci * Setting Subscribers. 77661847f8eSopenharmony_ci * 77761847f8eSopenharmony_ci * @type { Set<number> } 77861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 77961847f8eSopenharmony_ci * @systemapi 78061847f8eSopenharmony_ci * @since 7 78161847f8eSopenharmony_ci */ 78261847f8eSopenharmony_ci protected subscribers_: Set<number>; 78361847f8eSopenharmony_ci 78461847f8eSopenharmony_ci /** 78561847f8eSopenharmony_ci * Private user ID. 78661847f8eSopenharmony_ci * 78761847f8eSopenharmony_ci * @type { any } 78861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 78961847f8eSopenharmony_ci * @systemapi 79061847f8eSopenharmony_ci * @since 7 79161847f8eSopenharmony_ci */ 79261847f8eSopenharmony_ci private id_; 79361847f8eSopenharmony_ci 79461847f8eSopenharmony_ci /** 79561847f8eSopenharmony_ci * Private user information. 79661847f8eSopenharmony_ci * 79761847f8eSopenharmony_ci * @type { ?any } 79861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 79961847f8eSopenharmony_ci * @systemapi 80061847f8eSopenharmony_ci * @since 7 80161847f8eSopenharmony_ci */ 80261847f8eSopenharmony_ci private info_?; 80361847f8eSopenharmony_ci 80461847f8eSopenharmony_ci /** 80561847f8eSopenharmony_ci * @param { IPropertySubscriber } subscribeMe 80661847f8eSopenharmony_ci * @param { string } info 80761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 80861847f8eSopenharmony_ci * @systemapi 80961847f8eSopenharmony_ci * @since 7 81061847f8eSopenharmony_ci */ 81161847f8eSopenharmony_ci constructor( 81261847f8eSopenharmony_ci /** 81361847f8eSopenharmony_ci * Subscriber IPropertySubscriber. 81461847f8eSopenharmony_ci * 81561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 81661847f8eSopenharmony_ci * @systemapi 81761847f8eSopenharmony_ci * @since 7 81861847f8eSopenharmony_ci * 81961847f8eSopenharmony_ci */ 82061847f8eSopenharmony_ci subscribeMe?: IPropertySubscriber, 82161847f8eSopenharmony_ci /** 82261847f8eSopenharmony_ci * Subscriber info. 82361847f8eSopenharmony_ci * 82461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 82561847f8eSopenharmony_ci * @systemapi 82661847f8eSopenharmony_ci * @since 7 82761847f8eSopenharmony_ci * 82861847f8eSopenharmony_ci */ 82961847f8eSopenharmony_ci info?: string, 83061847f8eSopenharmony_ci ); 83161847f8eSopenharmony_ci 83261847f8eSopenharmony_ci /** 83361847f8eSopenharmony_ci * Called when the subscriber ID is entered. 83461847f8eSopenharmony_ci * 83561847f8eSopenharmony_ci * @returns { number } 83661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 83761847f8eSopenharmony_ci * @systemapi 83861847f8eSopenharmony_ci * @since 7 83961847f8eSopenharmony_ci */ 84061847f8eSopenharmony_ci id(): number; 84161847f8eSopenharmony_ci 84261847f8eSopenharmony_ci /** 84361847f8eSopenharmony_ci * Returns the property name, 84461847f8eSopenharmony_ci * e.g. let link = AppStorage.Link("foo") then link.info() == "foo" 84561847f8eSopenharmony_ci * 84661847f8eSopenharmony_ci * @returns { string } the property name if set or undefined 84761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 84861847f8eSopenharmony_ci * @crossplatform 84961847f8eSopenharmony_ci * @since 10 85061847f8eSopenharmony_ci */ 85161847f8eSopenharmony_ci /** 85261847f8eSopenharmony_ci * Returns the property name, 85361847f8eSopenharmony_ci * e.g. let link = AppStorage.Link("foo") then link.info() == "foo" 85461847f8eSopenharmony_ci * 85561847f8eSopenharmony_ci * @returns { string } the property name if set or undefined 85661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 85761847f8eSopenharmony_ci * @crossplatform 85861847f8eSopenharmony_ci * @atomicservice 85961847f8eSopenharmony_ci * @since 11 86061847f8eSopenharmony_ci */ 86161847f8eSopenharmony_ci info(): string; 86261847f8eSopenharmony_ci 86361847f8eSopenharmony_ci /** 86461847f8eSopenharmony_ci * Reads value of the sync'ed AppStorage/LocalStorage property. 86561847f8eSopenharmony_ci * `let link : SubscribedAbstractProperty<string> =AppStorage.Link<string>("foo")` 86661847f8eSopenharmony_ci * then `link.get()` returns the value of "foo" property in AppStorage. 86761847f8eSopenharmony_ci * 86861847f8eSopenharmony_ci * @returns { T } the value of the sync'ed AppStorage/LocalStorage property. 86961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 87061847f8eSopenharmony_ci * @form 87161847f8eSopenharmony_ci * @since 9 87261847f8eSopenharmony_ci */ 87361847f8eSopenharmony_ci /** 87461847f8eSopenharmony_ci * Reads value of the sync'ed AppStorage/LocalStorage property. 87561847f8eSopenharmony_ci * `let link : SubscribedAbstractProperty<string> =AppStorage.Link<string>("foo")` 87661847f8eSopenharmony_ci * then `link.get()` returns the value of "foo" property in AppStorage. 87761847f8eSopenharmony_ci * 87861847f8eSopenharmony_ci * @returns { T } the value of the sync'ed AppStorage/LocalStorage property. 87961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 88061847f8eSopenharmony_ci * @crossplatform 88161847f8eSopenharmony_ci * @form 88261847f8eSopenharmony_ci * @since 10 88361847f8eSopenharmony_ci */ 88461847f8eSopenharmony_ci /** 88561847f8eSopenharmony_ci * Reads value of the sync'ed AppStorage/LocalStorage property. 88661847f8eSopenharmony_ci * `let link : SubscribedAbstractProperty<string> =AppStorage.Link<string>("foo")` 88761847f8eSopenharmony_ci * then `link.get()` returns the value of "foo" property in AppStorage. 88861847f8eSopenharmony_ci * 88961847f8eSopenharmony_ci * @returns { T } the value of the sync'ed AppStorage/LocalStorage property. 89061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 89161847f8eSopenharmony_ci * @crossplatform 89261847f8eSopenharmony_ci * @form 89361847f8eSopenharmony_ci * @atomicservice 89461847f8eSopenharmony_ci * @since 11 89561847f8eSopenharmony_ci */ 89661847f8eSopenharmony_ci abstract get(): T; 89761847f8eSopenharmony_ci 89861847f8eSopenharmony_ci /** 89961847f8eSopenharmony_ci * Updates the value of value of the sync'ed AppStorage/LocalStorage property. 90061847f8eSopenharmony_ci * Sets new value, must be of type T, and must not be 'undefined' or 'null'. 90161847f8eSopenharmony_ci * `let link : SubscribedAbstractProperty<string> =AppStorage.Link<string>("foo")` 90261847f8eSopenharmony_ci * then `link.set("Hello")` will set the value of "foo" property in AppStorage. 90361847f8eSopenharmony_ci * 90461847f8eSopenharmony_ci * @param { T } newValue 90561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 90661847f8eSopenharmony_ci * @form 90761847f8eSopenharmony_ci * @since 9 90861847f8eSopenharmony_ci */ 90961847f8eSopenharmony_ci /** 91061847f8eSopenharmony_ci * Updates the value of value of the sync'ed AppStorage/LocalStorage property. 91161847f8eSopenharmony_ci * Sets new value, must be of type T, and must not be 'undefined' or 'null'. 91261847f8eSopenharmony_ci * `let link : SubscribedAbstractProperty<string> =AppStorage.Link<string>("foo")` 91361847f8eSopenharmony_ci * then `link.set("Hello")` will set the value of "foo" property in AppStorage. 91461847f8eSopenharmony_ci * 91561847f8eSopenharmony_ci * @param { T } newValue 91661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 91761847f8eSopenharmony_ci * @crossplatform 91861847f8eSopenharmony_ci * @form 91961847f8eSopenharmony_ci * @since 10 92061847f8eSopenharmony_ci */ 92161847f8eSopenharmony_ci /** 92261847f8eSopenharmony_ci * Updates the value of value of the sync'ed AppStorage/LocalStorage property. 92361847f8eSopenharmony_ci * Sets new value, must be of type T, and must not be 'undefined' or 'null'. 92461847f8eSopenharmony_ci * `let link : SubscribedAbstractProperty<string> =AppStorage.Link<string>("foo")` 92561847f8eSopenharmony_ci * then `link.set("Hello")` will set the value of "foo" property in AppStorage. 92661847f8eSopenharmony_ci * 92761847f8eSopenharmony_ci * @param { T } newValue 92861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 92961847f8eSopenharmony_ci * @crossplatform 93061847f8eSopenharmony_ci * @form 93161847f8eSopenharmony_ci * @atomicservice 93261847f8eSopenharmony_ci * @since 11 93361847f8eSopenharmony_ci */ 93461847f8eSopenharmony_ci /** 93561847f8eSopenharmony_ci * Updates the value of value of the sync'ed AppStorage/LocalStorage property. 93661847f8eSopenharmony_ci * Sets new value, must be of type T, can be undefined or null. 93761847f8eSopenharmony_ci * `let link : SubscribedAbstractProperty<string> =AppStorage.Link<string>("foo")` 93861847f8eSopenharmony_ci * then `link.set("Hello")` will set the value of "foo" property in AppStorage. 93961847f8eSopenharmony_ci * 94061847f8eSopenharmony_ci * @param { T } newValue 94161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 94261847f8eSopenharmony_ci * @crossplatform 94361847f8eSopenharmony_ci * @form 94461847f8eSopenharmony_ci * @atomicservice 94561847f8eSopenharmony_ci * @since 12 94661847f8eSopenharmony_ci */ 94761847f8eSopenharmony_ci abstract set(newValue: T): void; 94861847f8eSopenharmony_ci 94961847f8eSopenharmony_ci /** 95061847f8eSopenharmony_ci * Called when a two-way synchronization is created. 95161847f8eSopenharmony_ci * 95261847f8eSopenharmony_ci * @param { IPropertySubscriber } subscribeMe 95361847f8eSopenharmony_ci * @param { string } info 95461847f8eSopenharmony_ci * @returns { SyncedPropertyTwoWay<T> } 95561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 95661847f8eSopenharmony_ci * @systemapi 95761847f8eSopenharmony_ci * @since 7 95861847f8eSopenharmony_ci */ 95961847f8eSopenharmony_ci createTwoWaySync(subscribeMe?: IPropertySubscriber, info?: string): SyncedPropertyTwoWay<T>; 96061847f8eSopenharmony_ci 96161847f8eSopenharmony_ci /** 96261847f8eSopenharmony_ci * Called when a one-way synchronization is created. 96361847f8eSopenharmony_ci * 96461847f8eSopenharmony_ci * @param { IPropertySubscriber } subscribeMe 96561847f8eSopenharmony_ci * @param { string } info 96661847f8eSopenharmony_ci * @returns { SyncedPropertyOneWay<T> } 96761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 96861847f8eSopenharmony_ci * @systemapi 96961847f8eSopenharmony_ci * @since 7 97061847f8eSopenharmony_ci */ 97161847f8eSopenharmony_ci createOneWaySync(subscribeMe?: IPropertySubscriber, info?: string): SyncedPropertyOneWay<T>; 97261847f8eSopenharmony_ci 97361847f8eSopenharmony_ci /** 97461847f8eSopenharmony_ci * Called when the subscriber is unlinked. 97561847f8eSopenharmony_ci * 97661847f8eSopenharmony_ci * @param { number } subscriberId 97761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 97861847f8eSopenharmony_ci * @systemapi 97961847f8eSopenharmony_ci * @since 7 98061847f8eSopenharmony_ci */ 98161847f8eSopenharmony_ci unlinkSuscriber(subscriberId: number): void; 98261847f8eSopenharmony_ci 98361847f8eSopenharmony_ci /** 98461847f8eSopenharmony_ci * Called when the notification has changed. 98561847f8eSopenharmony_ci * 98661847f8eSopenharmony_ci * @param { T } newValue 98761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 98861847f8eSopenharmony_ci * @systemapi 98961847f8eSopenharmony_ci * @since 7 99061847f8eSopenharmony_ci */ 99161847f8eSopenharmony_ci protected notifyHasChanged(newValue: T): void; 99261847f8eSopenharmony_ci 99361847f8eSopenharmony_ci /** 99461847f8eSopenharmony_ci * Called when the notification property is read. 99561847f8eSopenharmony_ci * 99661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 99761847f8eSopenharmony_ci * @systemapi 99861847f8eSopenharmony_ci * @since 7 99961847f8eSopenharmony_ci */ 100061847f8eSopenharmony_ci protected notifyPropertyRead(): void; 100161847f8eSopenharmony_ci 100261847f8eSopenharmony_ci /** 100361847f8eSopenharmony_ci * Called when the number of users is queried. 100461847f8eSopenharmony_ci * 100561847f8eSopenharmony_ci * @returns { number } 100661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 100761847f8eSopenharmony_ci * @systemapi 100861847f8eSopenharmony_ci * @since 7 100961847f8eSopenharmony_ci */ 101061847f8eSopenharmony_ci numberOfSubscrbers(): number; 101161847f8eSopenharmony_ci 101261847f8eSopenharmony_ci /** 101361847f8eSopenharmony_ci * An app needs to call this function before the instance of SubscribedAbstractProperty 101461847f8eSopenharmony_ci * goes out of scope / is subject to garbage collection. Its purpose is to unregister the 101561847f8eSopenharmony_ci * variable from the two-way/one-way sync relationship that AppStorage/LocalStorage.link()/prop() 101661847f8eSopenharmony_ci * and related functions create. 101761847f8eSopenharmony_ci * 101861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 101961847f8eSopenharmony_ci * @crossplatform 102061847f8eSopenharmony_ci * @since 10 102161847f8eSopenharmony_ci */ 102261847f8eSopenharmony_ci /** 102361847f8eSopenharmony_ci * An app needs to call this function before the instance of SubscribedAbstractProperty 102461847f8eSopenharmony_ci * goes out of scope / is subject to garbage collection. Its purpose is to unregister the 102561847f8eSopenharmony_ci * variable from the two-way/one-way sync relationship that AppStorage/LocalStorage.link()/prop() 102661847f8eSopenharmony_ci * and related functions create. 102761847f8eSopenharmony_ci * 102861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 102961847f8eSopenharmony_ci * @crossplatform 103061847f8eSopenharmony_ci * @atomicservice 103161847f8eSopenharmony_ci * @since 11 103261847f8eSopenharmony_ci */ 103361847f8eSopenharmony_ci abstract aboutToBeDeleted(): void; 103461847f8eSopenharmony_ci} 103561847f8eSopenharmony_ci 103661847f8eSopenharmony_ci/** 103761847f8eSopenharmony_ci * Provides an interface for attribute subscribers. 103861847f8eSopenharmony_ci * 103961847f8eSopenharmony_ci * @interface IPropertySubscriber 104061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 104161847f8eSopenharmony_ci * @systemapi 104261847f8eSopenharmony_ci * @since 7 104361847f8eSopenharmony_ci */ 104461847f8eSopenharmony_ciinterface IPropertySubscriber { 104561847f8eSopenharmony_ci /** 104661847f8eSopenharmony_ci * Called when the ID of the property subscriber is queried. 104761847f8eSopenharmony_ci * 104861847f8eSopenharmony_ci * @returns { number } 104961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 105061847f8eSopenharmony_ci * @systemapi 105161847f8eSopenharmony_ci * @since 7 105261847f8eSopenharmony_ci */ 105361847f8eSopenharmony_ci id(): number; 105461847f8eSopenharmony_ci 105561847f8eSopenharmony_ci /** 105661847f8eSopenharmony_ci * Provides a single attribute change user interface. 105761847f8eSopenharmony_ci * 105861847f8eSopenharmony_ci * @param { IPropertySubscriber } owningView 105961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 106061847f8eSopenharmony_ci * @systemapi 106161847f8eSopenharmony_ci * @since 7 106261847f8eSopenharmony_ci */ 106361847f8eSopenharmony_ci aboutToBeDeleted(owningView?: IPropertySubscriber): void; 106461847f8eSopenharmony_ci} 106561847f8eSopenharmony_ci 106661847f8eSopenharmony_ci/** 106761847f8eSopenharmony_ci * Defines the state value. 106861847f8eSopenharmony_ci * 106961847f8eSopenharmony_ci * @extends SubscribedAbstractProperty<T> 107061847f8eSopenharmony_ci * @implements ISinglePropertyChangeSubscriber<T> 107161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 107261847f8eSopenharmony_ci * @systemapi 107361847f8eSopenharmony_ci * @since 7 107461847f8eSopenharmony_ci */ 107561847f8eSopenharmony_cideclare class SyncedPropertyTwoWay<T> 107661847f8eSopenharmony_ci extends SubscribedAbstractProperty<T> 107761847f8eSopenharmony_ci implements ISinglePropertyChangeSubscriber<T> 107861847f8eSopenharmony_ci{ 107961847f8eSopenharmony_ci /** 108061847f8eSopenharmony_ci * Sources of synchronization attributes bidirectionally. 108161847f8eSopenharmony_ci * 108261847f8eSopenharmony_ci * @type { any } 108361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 108461847f8eSopenharmony_ci * @systemapi 108561847f8eSopenharmony_ci * @since 7 108661847f8eSopenharmony_ci */ 108761847f8eSopenharmony_ci private source_; 108861847f8eSopenharmony_ci 108961847f8eSopenharmony_ci /** 109061847f8eSopenharmony_ci * constructor parameters. 109161847f8eSopenharmony_ci * 109261847f8eSopenharmony_ci * @param { SubscribedAbstractProperty<T> } source 109361847f8eSopenharmony_ci * @param { IPropertySubscriber } subscribeMe 109461847f8eSopenharmony_ci * @param { string } info 109561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 109661847f8eSopenharmony_ci * @systemapi 109761847f8eSopenharmony_ci * @since 7 109861847f8eSopenharmony_ci */ 109961847f8eSopenharmony_ci constructor(source: SubscribedAbstractProperty<T>, subscribeMe?: IPropertySubscriber, info?: string); 110061847f8eSopenharmony_ci 110161847f8eSopenharmony_ci /** 110261847f8eSopenharmony_ci * Called when processing information about to be deleted. 110361847f8eSopenharmony_ci * 110461847f8eSopenharmony_ci * @param { IPropertySubscriber } unsubscribeMe 110561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 110661847f8eSopenharmony_ci * @systemapi 110761847f8eSopenharmony_ci * @since 7 110861847f8eSopenharmony_ci */ 110961847f8eSopenharmony_ci aboutToBeDeleted(unsubscribeMe?: IPropertySubscriber): void; 111061847f8eSopenharmony_ci 111161847f8eSopenharmony_ci /** 111261847f8eSopenharmony_ci * Information Changed. 111361847f8eSopenharmony_ci * 111461847f8eSopenharmony_ci * @param { T } newValue 111561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 111661847f8eSopenharmony_ci * @systemapi 111761847f8eSopenharmony_ci * @since 7 111861847f8eSopenharmony_ci */ 111961847f8eSopenharmony_ci hasChanged(newValue: T): void; 112061847f8eSopenharmony_ci 112161847f8eSopenharmony_ci /** 112261847f8eSopenharmony_ci * Called when data is obtained. 112361847f8eSopenharmony_ci * 112461847f8eSopenharmony_ci * @returns { T } 112561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 112661847f8eSopenharmony_ci * @systemapi 112761847f8eSopenharmony_ci * @since 7 112861847f8eSopenharmony_ci */ 112961847f8eSopenharmony_ci get(): T; 113061847f8eSopenharmony_ci 113161847f8eSopenharmony_ci /** 113261847f8eSopenharmony_ci * Called when data is created. 113361847f8eSopenharmony_ci * 113461847f8eSopenharmony_ci * @param { T } newValue 113561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 113661847f8eSopenharmony_ci * @systemapi 113761847f8eSopenharmony_ci * @since 7 113861847f8eSopenharmony_ci */ 113961847f8eSopenharmony_ci set(newValue: T): void; 114061847f8eSopenharmony_ci} 114161847f8eSopenharmony_ci 114261847f8eSopenharmony_ci/** 114361847f8eSopenharmony_ci * Defines the prop state value. 114461847f8eSopenharmony_ci * 114561847f8eSopenharmony_ci * @extends SubscribedAbstractProperty<T> 114661847f8eSopenharmony_ci * @implements ISinglePropertyChangeSubscriber<T> 114761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 114861847f8eSopenharmony_ci * @systemapi 114961847f8eSopenharmony_ci * @since 7 115061847f8eSopenharmony_ci */ 115161847f8eSopenharmony_cideclare class SyncedPropertyOneWay<T> 115261847f8eSopenharmony_ci extends SubscribedAbstractProperty<T> 115361847f8eSopenharmony_ci implements ISinglePropertyChangeSubscriber<T> 115461847f8eSopenharmony_ci{ 115561847f8eSopenharmony_ci /** 115661847f8eSopenharmony_ci * Pack value for single-item binding. 115761847f8eSopenharmony_ci * 115861847f8eSopenharmony_ci * @type { any } 115961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 116061847f8eSopenharmony_ci * @systemapi 116161847f8eSopenharmony_ci * @since 7 116261847f8eSopenharmony_ci */ 116361847f8eSopenharmony_ci private wrappedValue_; 116461847f8eSopenharmony_ci 116561847f8eSopenharmony_ci /** 116661847f8eSopenharmony_ci * Sources of synchronization attributes bidirectionally. 116761847f8eSopenharmony_ci * 116861847f8eSopenharmony_ci * @type { any } 116961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 117061847f8eSopenharmony_ci * @systemapi 117161847f8eSopenharmony_ci * @since 7 117261847f8eSopenharmony_ci */ 117361847f8eSopenharmony_ci private source_; 117461847f8eSopenharmony_ci 117561847f8eSopenharmony_ci /** 117661847f8eSopenharmony_ci * Constructor parameters. 117761847f8eSopenharmony_ci * 117861847f8eSopenharmony_ci * @param { SubscribedAbstractProperty<T> } source 117961847f8eSopenharmony_ci * @param { IPropertySubscriber } subscribeMe 118061847f8eSopenharmony_ci * @param { string } info 118161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 118261847f8eSopenharmony_ci * @systemapi 118361847f8eSopenharmony_ci * @since 7 118461847f8eSopenharmony_ci */ 118561847f8eSopenharmony_ci constructor(source: SubscribedAbstractProperty<T>, subscribeMe?: IPropertySubscriber, info?: string); 118661847f8eSopenharmony_ci 118761847f8eSopenharmony_ci /** 118861847f8eSopenharmony_ci * Called when processing information about to be deleted. 118961847f8eSopenharmony_ci * 119061847f8eSopenharmony_ci * @param { IPropertySubscriber } unsubscribeMe 119161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 119261847f8eSopenharmony_ci * @systemapi 119361847f8eSopenharmony_ci * @since 7 119461847f8eSopenharmony_ci */ 119561847f8eSopenharmony_ci aboutToBeDeleted(unsubscribeMe?: IPropertySubscriber): void; 119661847f8eSopenharmony_ci 119761847f8eSopenharmony_ci /** 119861847f8eSopenharmony_ci * Information Changed. 119961847f8eSopenharmony_ci * 120061847f8eSopenharmony_ci * @param { T } newValue 120161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 120261847f8eSopenharmony_ci * @systemapi 120361847f8eSopenharmony_ci * @since 7 120461847f8eSopenharmony_ci */ 120561847f8eSopenharmony_ci hasChanged(newValue: T): void; 120661847f8eSopenharmony_ci 120761847f8eSopenharmony_ci /** 120861847f8eSopenharmony_ci * Called when data is obtained. 120961847f8eSopenharmony_ci * 121061847f8eSopenharmony_ci * @returns { T } 121161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 121261847f8eSopenharmony_ci * @systemapi 121361847f8eSopenharmony_ci * @since 7 121461847f8eSopenharmony_ci */ 121561847f8eSopenharmony_ci get(): T; 121661847f8eSopenharmony_ci 121761847f8eSopenharmony_ci /** 121861847f8eSopenharmony_ci * Called when data is created. 121961847f8eSopenharmony_ci * 122061847f8eSopenharmony_ci * @param { T } newValue 122161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 122261847f8eSopenharmony_ci * @systemapi 122361847f8eSopenharmony_ci * @since 7 122461847f8eSopenharmony_ci */ 122561847f8eSopenharmony_ci set(newValue: T): void; 122661847f8eSopenharmony_ci} 122761847f8eSopenharmony_ci 122861847f8eSopenharmony_ci/** 122961847f8eSopenharmony_ci * Defines the subscriber. 123061847f8eSopenharmony_ci * 123161847f8eSopenharmony_ci * @interface ISinglePropertyChangeSubscriber 123261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 123361847f8eSopenharmony_ci * @systemapi 123461847f8eSopenharmony_ci * @since 7 123561847f8eSopenharmony_ci */ 123661847f8eSopenharmony_ciinterface ISinglePropertyChangeSubscriber<T> extends IPropertySubscriber { 123761847f8eSopenharmony_ci /** 123861847f8eSopenharmony_ci * Provides a single attribute change user interface. 123961847f8eSopenharmony_ci * 124061847f8eSopenharmony_ci * @param { T } newValue 124161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 124261847f8eSopenharmony_ci * @systemapi 124361847f8eSopenharmony_ci * @since 7 124461847f8eSopenharmony_ci */ 124561847f8eSopenharmony_ci hasChanged(newValue: T): void; 124661847f8eSopenharmony_ci} 124761847f8eSopenharmony_ci 124861847f8eSopenharmony_ci/** 124961847f8eSopenharmony_ci * Defines the Subscribale base class. 125061847f8eSopenharmony_ci * 125161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 125261847f8eSopenharmony_ci * @systemapi 125361847f8eSopenharmony_ci * @since 7 125461847f8eSopenharmony_ci */ 125561847f8eSopenharmony_cideclare abstract class SubscribaleAbstract { 125661847f8eSopenharmony_ci /** 125761847f8eSopenharmony_ci * Returns the ownership attribute set by the. 125861847f8eSopenharmony_ci * 125961847f8eSopenharmony_ci * @type { Set<number> } 126061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 126161847f8eSopenharmony_ci * @systemapi 126261847f8eSopenharmony_ci * @since 7 126361847f8eSopenharmony_ci */ 126461847f8eSopenharmony_ci private owningProperties_: Set<number>; 126561847f8eSopenharmony_ci 126661847f8eSopenharmony_ci /** 126761847f8eSopenharmony_ci * Constructor. 126861847f8eSopenharmony_ci * 126961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 127061847f8eSopenharmony_ci * @systemapi 127161847f8eSopenharmony_ci * @since 7 127261847f8eSopenharmony_ci */ 127361847f8eSopenharmony_ci constructor(); 127461847f8eSopenharmony_ci 127561847f8eSopenharmony_ci /** 127661847f8eSopenharmony_ci * Called when the notification property has changed. 127761847f8eSopenharmony_ci * 127861847f8eSopenharmony_ci * @param { string } propName 127961847f8eSopenharmony_ci * @param { any } newValue 128061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 128161847f8eSopenharmony_ci * @systemapi 128261847f8eSopenharmony_ci * @since 7 128361847f8eSopenharmony_ci */ 128461847f8eSopenharmony_ci protected notifyPropertyHasChanged(propName: string, newValue: any): void; 128561847f8eSopenharmony_ci 128661847f8eSopenharmony_ci /** 128761847f8eSopenharmony_ci * Called when adding an already owned property. 128861847f8eSopenharmony_ci * 128961847f8eSopenharmony_ci * @param { IPropertySubscriber } subscriber 129061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 129161847f8eSopenharmony_ci * @systemapi 129261847f8eSopenharmony_ci * @since 7 129361847f8eSopenharmony_ci */ 129461847f8eSopenharmony_ci public addOwningProperty(subscriber: IPropertySubscriber): void; 129561847f8eSopenharmony_ci 129661847f8eSopenharmony_ci /** 129761847f8eSopenharmony_ci * Called when an already owned property is deleted. 129861847f8eSopenharmony_ci * 129961847f8eSopenharmony_ci * @param { IPropertySubscriber } property 130061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 130161847f8eSopenharmony_ci * @systemapi 130261847f8eSopenharmony_ci * @since 7 130361847f8eSopenharmony_ci */ 130461847f8eSopenharmony_ci public removeOwningProperty(property: IPropertySubscriber): void; 130561847f8eSopenharmony_ci 130661847f8eSopenharmony_ci /** 130761847f8eSopenharmony_ci * Called when an already owned property is deleted by ID 130861847f8eSopenharmony_ci * 130961847f8eSopenharmony_ci * @param { number } subscriberId 131061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 131161847f8eSopenharmony_ci * @systemapi 131261847f8eSopenharmony_ci * @since 7 131361847f8eSopenharmony_ci */ 131461847f8eSopenharmony_ci public removeOwningPropertyById(subscriberId: number): void; 131561847f8eSopenharmony_ci} 131661847f8eSopenharmony_ci 131761847f8eSopenharmony_ci/** 131861847f8eSopenharmony_ci * EnvProps object 131961847f8eSopenharmony_ci * 132061847f8eSopenharmony_ci * @interface EnvPropsOptions 132161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 132261847f8eSopenharmony_ci * @crossplatform 132361847f8eSopenharmony_ci * @since 10 132461847f8eSopenharmony_ci */ 132561847f8eSopenharmony_ci/** 132661847f8eSopenharmony_ci * EnvProps object 132761847f8eSopenharmony_ci * 132861847f8eSopenharmony_ci * @interface EnvPropsOptions 132961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 133061847f8eSopenharmony_ci * @crossplatform 133161847f8eSopenharmony_ci * @atomicservice 133261847f8eSopenharmony_ci * @since 11 133361847f8eSopenharmony_ci */ 133461847f8eSopenharmony_cideclare interface EnvPropsOptions { 133561847f8eSopenharmony_ci /** 133661847f8eSopenharmony_ci * Property name of Environment variable 133761847f8eSopenharmony_ci * 133861847f8eSopenharmony_ci * @type { string } 133961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 134061847f8eSopenharmony_ci * @crossplatform 134161847f8eSopenharmony_ci * @since 10 134261847f8eSopenharmony_ci */ 134361847f8eSopenharmony_ci /** 134461847f8eSopenharmony_ci * Property name of Environment variable 134561847f8eSopenharmony_ci * 134661847f8eSopenharmony_ci * @type { string } 134761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 134861847f8eSopenharmony_ci * @crossplatform 134961847f8eSopenharmony_ci * @atomicservice 135061847f8eSopenharmony_ci * @since 11 135161847f8eSopenharmony_ci */ 135261847f8eSopenharmony_ci key: string; 135361847f8eSopenharmony_ci 135461847f8eSopenharmony_ci /** 135561847f8eSopenharmony_ci * DefaultValue is the default value if cannot get the environment property value 135661847f8eSopenharmony_ci * 135761847f8eSopenharmony_ci * @type { number | string | boolean } 135861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 135961847f8eSopenharmony_ci * @crossplatform 136061847f8eSopenharmony_ci * @since 10 136161847f8eSopenharmony_ci */ 136261847f8eSopenharmony_ci /** 136361847f8eSopenharmony_ci * DefaultValue is the default value if cannot get the environment property value 136461847f8eSopenharmony_ci * 136561847f8eSopenharmony_ci * @type { number | string | boolean } 136661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 136761847f8eSopenharmony_ci * @crossplatform 136861847f8eSopenharmony_ci * @atomicservice 136961847f8eSopenharmony_ci * @since 11 137061847f8eSopenharmony_ci */ 137161847f8eSopenharmony_ci defaultValue: number | string | boolean; 137261847f8eSopenharmony_ci} 137361847f8eSopenharmony_ci 137461847f8eSopenharmony_ci/** 137561847f8eSopenharmony_ci * Defines the Environment interface. 137661847f8eSopenharmony_ci * 137761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 137861847f8eSopenharmony_ci * @since 7 137961847f8eSopenharmony_ci */ 138061847f8eSopenharmony_ci/** 138161847f8eSopenharmony_ci * Defines the Environment interface. 138261847f8eSopenharmony_ci * 138361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 138461847f8eSopenharmony_ci * @crossplatform 138561847f8eSopenharmony_ci * @since 10 138661847f8eSopenharmony_ci */ 138761847f8eSopenharmony_ci/** 138861847f8eSopenharmony_ci * Defines the Environment interface. 138961847f8eSopenharmony_ci * 139061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 139161847f8eSopenharmony_ci * @crossplatform 139261847f8eSopenharmony_ci * @atomicservice 139361847f8eSopenharmony_ci * @since 11 139461847f8eSopenharmony_ci */ 139561847f8eSopenharmony_cideclare class Environment { 139661847f8eSopenharmony_ci /** 139761847f8eSopenharmony_ci * Constructor. 139861847f8eSopenharmony_ci * 139961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 140061847f8eSopenharmony_ci * @systemapi 140161847f8eSopenharmony_ci * @since 7 140261847f8eSopenharmony_ci */ 140361847f8eSopenharmony_ci constructor(); 140461847f8eSopenharmony_ci 140561847f8eSopenharmony_ci /** 140661847f8eSopenharmony_ci * Called when a property value is added to Environment. 140761847f8eSopenharmony_ci * 140861847f8eSopenharmony_ci * @param { string } key 140961847f8eSopenharmony_ci * @param { S } value 141061847f8eSopenharmony_ci * @returns { boolean } 141161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 141261847f8eSopenharmony_ci * @since 7 141361847f8eSopenharmony_ci * @deprecated since 10 141461847f8eSopenharmony_ci * @useinstead Environment#envProp 141561847f8eSopenharmony_ci */ 141661847f8eSopenharmony_ci static EnvProp<S>(key: string, value: S): boolean; 141761847f8eSopenharmony_ci 141861847f8eSopenharmony_ci /** 141961847f8eSopenharmony_ci * Creates a new property in AppStorage. The UI framework implementation takes care of updating 142061847f8eSopenharmony_ci * its value whenever the named device environment property changes. Recommended use is at app startup. 142161847f8eSopenharmony_ci * The function call fails and returns false if a property with given name exists in AppStorage already. 142261847f8eSopenharmony_ci * It is wrong API use to access a property with given name in AppStorage before calling Environment.envProp. 142361847f8eSopenharmony_ci * 142461847f8eSopenharmony_ci * @param { string } key - environment property 142561847f8eSopenharmony_ci * @param { S } value - is the default value if cannot get the environment property value 142661847f8eSopenharmony_ci * @returns { boolean } false if method failed 142761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 142861847f8eSopenharmony_ci * @crossplatform 142961847f8eSopenharmony_ci * @since 10 143061847f8eSopenharmony_ci */ 143161847f8eSopenharmony_ci /** 143261847f8eSopenharmony_ci * Creates a new property in AppStorage. The UI framework implementation takes care of updating 143361847f8eSopenharmony_ci * its value whenever the named device environment property changes. Recommended use is at app startup. 143461847f8eSopenharmony_ci * The function call fails and returns false if a property with given name exists in AppStorage already. 143561847f8eSopenharmony_ci * It is wrong API use to access a property with given name in AppStorage before calling Environment.envProp. 143661847f8eSopenharmony_ci * 143761847f8eSopenharmony_ci * @param { string } key - environment property 143861847f8eSopenharmony_ci * @param { S } value - is the default value if cannot get the environment property value 143961847f8eSopenharmony_ci * @returns { boolean } false if method failed 144061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 144161847f8eSopenharmony_ci * @crossplatform 144261847f8eSopenharmony_ci * @atomicservice 144361847f8eSopenharmony_ci * @since 11 144461847f8eSopenharmony_ci */ 144561847f8eSopenharmony_ci static envProp<S>(key: string, value: S): boolean; 144661847f8eSopenharmony_ci 144761847f8eSopenharmony_ci /** 144861847f8eSopenharmony_ci * Called when multiple property values are added to Environment. 144961847f8eSopenharmony_ci * 145061847f8eSopenharmony_ci * @param { {key: string;defaultValue: any;}[] } props 145161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 145261847f8eSopenharmony_ci * @since 7 145361847f8eSopenharmony_ci * @deprecated since 10 145461847f8eSopenharmony_ci * @useinstead Environment#envProps 145561847f8eSopenharmony_ci */ 145661847f8eSopenharmony_ci static EnvProps( 145761847f8eSopenharmony_ci props: { 145861847f8eSopenharmony_ci key: string; 145961847f8eSopenharmony_ci defaultValue: any; 146061847f8eSopenharmony_ci }[], 146161847f8eSopenharmony_ci ): void; 146261847f8eSopenharmony_ci 146361847f8eSopenharmony_ci /** 146461847f8eSopenharmony_ci * Called when multiple property values are added to Environment. 146561847f8eSopenharmony_ci * 146661847f8eSopenharmony_ci * @param { EnvPropsOptions[] } props 146761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 146861847f8eSopenharmony_ci * @crossplatform 146961847f8eSopenharmony_ci * @since 10 147061847f8eSopenharmony_ci */ 147161847f8eSopenharmony_ci /** 147261847f8eSopenharmony_ci * Called when multiple property values are added to Environment. 147361847f8eSopenharmony_ci * 147461847f8eSopenharmony_ci * @param { EnvPropsOptions[] } props 147561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 147661847f8eSopenharmony_ci * @crossplatform 147761847f8eSopenharmony_ci * @atomicservice 147861847f8eSopenharmony_ci * @since 11 147961847f8eSopenharmony_ci */ 148061847f8eSopenharmony_ci static envProps(props: EnvPropsOptions[]): void; 148161847f8eSopenharmony_ci 148261847f8eSopenharmony_ci /** 148361847f8eSopenharmony_ci * returns an Array<string> of all environment property keys 148461847f8eSopenharmony_ci * 148561847f8eSopenharmony_ci * @returns { Array<string> } 148661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 148761847f8eSopenharmony_ci * @since 7 148861847f8eSopenharmony_ci * @deprecated since 10 148961847f8eSopenharmony_ci * @useinstead Environment#keys 149061847f8eSopenharmony_ci */ 149161847f8eSopenharmony_ci static Keys(): Array<string>; 149261847f8eSopenharmony_ci 149361847f8eSopenharmony_ci /** 149461847f8eSopenharmony_ci * returns an Array<string> of all environment property keys 149561847f8eSopenharmony_ci * 149661847f8eSopenharmony_ci * @returns { Array<string> } all environment property keys 149761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 149861847f8eSopenharmony_ci * @crossplatform 149961847f8eSopenharmony_ci * @since 10 150061847f8eSopenharmony_ci */ 150161847f8eSopenharmony_ci /** 150261847f8eSopenharmony_ci * returns an Array<string> of all environment property keys 150361847f8eSopenharmony_ci * 150461847f8eSopenharmony_ci * @returns { Array<string> } all environment property keys 150561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 150661847f8eSopenharmony_ci * @crossplatform 150761847f8eSopenharmony_ci * @atomicservice 150861847f8eSopenharmony_ci * @since 11 150961847f8eSopenharmony_ci */ 151061847f8eSopenharmony_ci static keys(): Array<string>; 151161847f8eSopenharmony_ci} 151261847f8eSopenharmony_ci 151361847f8eSopenharmony_ci/** 151461847f8eSopenharmony_ci * PersistProps object 151561847f8eSopenharmony_ci * 151661847f8eSopenharmony_ci * @interface PersistPropsOptions 151761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 151861847f8eSopenharmony_ci * @crossplatform 151961847f8eSopenharmony_ci * @since 10 152061847f8eSopenharmony_ci */ 152161847f8eSopenharmony_ci/** 152261847f8eSopenharmony_ci * PersistProps object 152361847f8eSopenharmony_ci * 152461847f8eSopenharmony_ci * @interface PersistPropsOptions 152561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 152661847f8eSopenharmony_ci * @crossplatform 152761847f8eSopenharmony_ci * @atomicservice 152861847f8eSopenharmony_ci * @since 11 152961847f8eSopenharmony_ci */ 153061847f8eSopenharmony_cideclare interface PersistPropsOptions { 153161847f8eSopenharmony_ci /** 153261847f8eSopenharmony_ci * Property name 153361847f8eSopenharmony_ci * 153461847f8eSopenharmony_ci * @type { string } 153561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 153661847f8eSopenharmony_ci * @crossplatform 153761847f8eSopenharmony_ci * @since 10 153861847f8eSopenharmony_ci */ 153961847f8eSopenharmony_ci /** 154061847f8eSopenharmony_ci * Property name 154161847f8eSopenharmony_ci * 154261847f8eSopenharmony_ci * @type { string } 154361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 154461847f8eSopenharmony_ci * @crossplatform 154561847f8eSopenharmony_ci * @atomicservice 154661847f8eSopenharmony_ci * @since 11 154761847f8eSopenharmony_ci */ 154861847f8eSopenharmony_ci key: string; 154961847f8eSopenharmony_ci 155061847f8eSopenharmony_ci /** 155161847f8eSopenharmony_ci * If AppStorage does not include this property it will be initialized with this value 155261847f8eSopenharmony_ci * 155361847f8eSopenharmony_ci * @type { number | string | boolean | Object } 155461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 155561847f8eSopenharmony_ci * @crossplatform 155661847f8eSopenharmony_ci * @since 10 155761847f8eSopenharmony_ci */ 155861847f8eSopenharmony_ci /** 155961847f8eSopenharmony_ci * If AppStorage does not include this property it will be initialized with this value 156061847f8eSopenharmony_ci * 156161847f8eSopenharmony_ci * @type { number | string | boolean | Object } 156261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 156361847f8eSopenharmony_ci * @crossplatform 156461847f8eSopenharmony_ci * @atomicservice 156561847f8eSopenharmony_ci * @since 11 156661847f8eSopenharmony_ci */ 156761847f8eSopenharmony_ci defaultValue: number | string | boolean | Object; 156861847f8eSopenharmony_ci} 156961847f8eSopenharmony_ci 157061847f8eSopenharmony_ci/** 157161847f8eSopenharmony_ci * Defines the PersistentStorage interface. 157261847f8eSopenharmony_ci * 157361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 157461847f8eSopenharmony_ci * @since 7 157561847f8eSopenharmony_ci */ 157661847f8eSopenharmony_ci/** 157761847f8eSopenharmony_ci * Defines the PersistentStorage interface. 157861847f8eSopenharmony_ci * 157961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 158061847f8eSopenharmony_ci * @crossplatform 158161847f8eSopenharmony_ci * @since 10 158261847f8eSopenharmony_ci */ 158361847f8eSopenharmony_ci/** 158461847f8eSopenharmony_ci * Defines the PersistentStorage interface. 158561847f8eSopenharmony_ci * 158661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 158761847f8eSopenharmony_ci * @crossplatform 158861847f8eSopenharmony_ci * @atomicservice 158961847f8eSopenharmony_ci * @since 11 159061847f8eSopenharmony_ci */ 159161847f8eSopenharmony_cideclare class PersistentStorage { 159261847f8eSopenharmony_ci /** 159361847f8eSopenharmony_ci * Constructor parameters. 159461847f8eSopenharmony_ci * 159561847f8eSopenharmony_ci * @param { AppStorage } appStorage 159661847f8eSopenharmony_ci * @param { Storage } storage 159761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 159861847f8eSopenharmony_ci * @systemapi 159961847f8eSopenharmony_ci * @since 7 160061847f8eSopenharmony_ci */ 160161847f8eSopenharmony_ci constructor(appStorage: AppStorage, storage: Storage); 160261847f8eSopenharmony_ci 160361847f8eSopenharmony_ci /** 160461847f8eSopenharmony_ci * Called when a persistence property is stored. 160561847f8eSopenharmony_ci * 160661847f8eSopenharmony_ci * @param { string } key 160761847f8eSopenharmony_ci * @param { T } defaultValue 160861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 160961847f8eSopenharmony_ci * @since 7 161061847f8eSopenharmony_ci * @deprecated since 10 161161847f8eSopenharmony_ci * @useinstead PersistentStorage#persistProp 161261847f8eSopenharmony_ci */ 161361847f8eSopenharmony_ci static PersistProp<T>(key: string, defaultValue: T): void; 161461847f8eSopenharmony_ci 161561847f8eSopenharmony_ci /** 161661847f8eSopenharmony_ci * Add property 'key' to AppStorage properties whose current value will be 161761847f8eSopenharmony_ci * persistent. 161861847f8eSopenharmony_ci * If AppStorage does not include this property it will be added and initializes 161961847f8eSopenharmony_ci * with given value 162061847f8eSopenharmony_ci * 162161847f8eSopenharmony_ci * @param { string } key - property name 162261847f8eSopenharmony_ci * @param { T } defaultValue - If AppStorage does not include this property it will be initialized with this value 162361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 162461847f8eSopenharmony_ci * @crossplatform 162561847f8eSopenharmony_ci * @since 10 162661847f8eSopenharmony_ci */ 162761847f8eSopenharmony_ci /** 162861847f8eSopenharmony_ci * Add property 'key' to AppStorage properties whose current value will be 162961847f8eSopenharmony_ci * persistent. 163061847f8eSopenharmony_ci * If AppStorage does not include this property it will be added and initializes 163161847f8eSopenharmony_ci * with given value 163261847f8eSopenharmony_ci * 163361847f8eSopenharmony_ci * @param { string } key - property name 163461847f8eSopenharmony_ci * @param { T } defaultValue - If AppStorage does not include this property it will be initialized with this value 163561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 163661847f8eSopenharmony_ci * @crossplatform 163761847f8eSopenharmony_ci * @atomicservice 163861847f8eSopenharmony_ci * @since 11 163961847f8eSopenharmony_ci */ 164061847f8eSopenharmony_ci static persistProp<T>(key: string, defaultValue: T): void; 164161847f8eSopenharmony_ci 164261847f8eSopenharmony_ci /** 164361847f8eSopenharmony_ci * Called when a property is deleted. 164461847f8eSopenharmony_ci * 164561847f8eSopenharmony_ci * @param { string } key 164661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 164761847f8eSopenharmony_ci * @since 7 164861847f8eSopenharmony_ci * @deprecated since 10 164961847f8eSopenharmony_ci * @useinstead PersistentStorage#deleteProp 165061847f8eSopenharmony_ci */ 165161847f8eSopenharmony_ci static DeleteProp(key: string): void; 165261847f8eSopenharmony_ci 165361847f8eSopenharmony_ci /** 165461847f8eSopenharmony_ci * Reverse of @see persistProp 165561847f8eSopenharmony_ci * 165661847f8eSopenharmony_ci * @param { string } key - no longer persist the property named key 165761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 165861847f8eSopenharmony_ci * @crossplatform 165961847f8eSopenharmony_ci * @since 10 166061847f8eSopenharmony_ci */ 166161847f8eSopenharmony_ci /** 166261847f8eSopenharmony_ci * Reverse of @see persistProp 166361847f8eSopenharmony_ci * 166461847f8eSopenharmony_ci * @param { string } key - no longer persist the property named key 166561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 166661847f8eSopenharmony_ci * @crossplatform 166761847f8eSopenharmony_ci * @atomicservice 166861847f8eSopenharmony_ci * @since 11 166961847f8eSopenharmony_ci */ 167061847f8eSopenharmony_ci static deleteProp(key: string): void; 167161847f8eSopenharmony_ci 167261847f8eSopenharmony_ci /** 167361847f8eSopenharmony_ci * Called when multiple persistence properties are stored. 167461847f8eSopenharmony_ci * 167561847f8eSopenharmony_ci * @param { {key: string;defaultValue: any;}[] } properties 167661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 167761847f8eSopenharmony_ci * @since 7 167861847f8eSopenharmony_ci * @deprecated since 10 167961847f8eSopenharmony_ci * @useinstead PersistentStorage#PersistProps 168061847f8eSopenharmony_ci */ 168161847f8eSopenharmony_ci static PersistProps( 168261847f8eSopenharmony_ci properties: { 168361847f8eSopenharmony_ci key: string; 168461847f8eSopenharmony_ci defaultValue: any; 168561847f8eSopenharmony_ci }[], 168661847f8eSopenharmony_ci ): void; 168761847f8eSopenharmony_ci 168861847f8eSopenharmony_ci /** 168961847f8eSopenharmony_ci * Persist given AppStorage properties with given names. 169061847f8eSopenharmony_ci * If a property does not exist in AppStorage, add it and initialize it with given value 169161847f8eSopenharmony_ci * works as @see persistProp for multiple properties. 169261847f8eSopenharmony_ci * 169361847f8eSopenharmony_ci * @param { PersistPropsOptions[] } props 169461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 169561847f8eSopenharmony_ci * @crossplatform 169661847f8eSopenharmony_ci * @since 10 169761847f8eSopenharmony_ci */ 169861847f8eSopenharmony_ci /** 169961847f8eSopenharmony_ci * Persist given AppStorage properties with given names. 170061847f8eSopenharmony_ci * If a property does not exist in AppStorage, add it and initialize it with given value 170161847f8eSopenharmony_ci * works as @see persistProp for multiple properties. 170261847f8eSopenharmony_ci * 170361847f8eSopenharmony_ci * @param { PersistPropsOptions[] } props 170461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 170561847f8eSopenharmony_ci * @crossplatform 170661847f8eSopenharmony_ci * @atomicservice 170761847f8eSopenharmony_ci * @since 11 170861847f8eSopenharmony_ci */ 170961847f8eSopenharmony_ci static persistProps(props: PersistPropsOptions[]): void; 171061847f8eSopenharmony_ci 171161847f8eSopenharmony_ci /** 171261847f8eSopenharmony_ci * Inform persisted AppStorage property names 171361847f8eSopenharmony_ci * returns an Array<string> of persisted AppStorage property names 171461847f8eSopenharmony_ci * 171561847f8eSopenharmony_ci * @returns { Array<string> } 171661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 171761847f8eSopenharmony_ci * @since 7 171861847f8eSopenharmony_ci * @deprecated since 10 171961847f8eSopenharmony_ci * @useinstead PersistentStorage#keys 172061847f8eSopenharmony_ci */ 172161847f8eSopenharmony_ci static Keys(): Array<string>; 172261847f8eSopenharmony_ci 172361847f8eSopenharmony_ci /** 172461847f8eSopenharmony_ci * Inform persisted AppStorage property names 172561847f8eSopenharmony_ci * returns an Array<string> of persisted AppStorage property names 172661847f8eSopenharmony_ci * 172761847f8eSopenharmony_ci * @returns { Array<string> } array of AppStorage keys 172861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 172961847f8eSopenharmony_ci * @crossplatform 173061847f8eSopenharmony_ci * @since 10 173161847f8eSopenharmony_ci */ 173261847f8eSopenharmony_ci /** 173361847f8eSopenharmony_ci * Inform persisted AppStorage property names 173461847f8eSopenharmony_ci * 173561847f8eSopenharmony_ci * @returns { Array<string> } array of AppStorage keys 173661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 173761847f8eSopenharmony_ci * @crossplatform 173861847f8eSopenharmony_ci * @atomicservice 173961847f8eSopenharmony_ci * @since 11 174061847f8eSopenharmony_ci */ 174161847f8eSopenharmony_ci static keys(): Array<string>; 174261847f8eSopenharmony_ci} 174361847f8eSopenharmony_ci 174461847f8eSopenharmony_ci/** 174561847f8eSopenharmony_ci * Used for ide. 174661847f8eSopenharmony_ci * 174761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 174861847f8eSopenharmony_ci * @systemapi 174961847f8eSopenharmony_ci * @since 7 175061847f8eSopenharmony_ci */ 175161847f8eSopenharmony_cideclare const appStorage: AppStorage; 175261847f8eSopenharmony_ci 175361847f8eSopenharmony_ci/** 175461847f8eSopenharmony_ci * LocalStorage 175561847f8eSopenharmony_ci * Class implements a Map of ObservableObjectBase UI state variables. 175661847f8eSopenharmony_ci * Instances can be created to manage UI state within a limited "local" 175761847f8eSopenharmony_ci * access, and life cycle as defined by the app. 175861847f8eSopenharmony_ci * AppStorage singleton is sub-class of LocalStorage for 175961847f8eSopenharmony_ci * UI state of app-wide access and same life cycle as the app. 176061847f8eSopenharmony_ci * 176161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 176261847f8eSopenharmony_ci * @form 176361847f8eSopenharmony_ci * @since 9 176461847f8eSopenharmony_ci */ 176561847f8eSopenharmony_ci/** 176661847f8eSopenharmony_ci * LocalStorage 176761847f8eSopenharmony_ci * Class implements a Map of ObservableObjectBase UI state variables. 176861847f8eSopenharmony_ci * Instances can be created to manage UI state within a limited "local" 176961847f8eSopenharmony_ci * access, and life cycle as defined by the app. 177061847f8eSopenharmony_ci * AppStorage singleton is sub-class of LocalStorage for 177161847f8eSopenharmony_ci * UI state of app-wide access and same life cycle as the app. 177261847f8eSopenharmony_ci * 177361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 177461847f8eSopenharmony_ci * @crossplatform 177561847f8eSopenharmony_ci * @form 177661847f8eSopenharmony_ci * @since 10 177761847f8eSopenharmony_ci */ 177861847f8eSopenharmony_ci/** 177961847f8eSopenharmony_ci * LocalStorage 178061847f8eSopenharmony_ci * Class implements a Map of ObservableObjectBase UI state variables. 178161847f8eSopenharmony_ci * Instances can be created to manage UI state within a limited "local" 178261847f8eSopenharmony_ci * access, and life cycle as defined by the app. 178361847f8eSopenharmony_ci * AppStorage singleton is sub-class of LocalStorage for 178461847f8eSopenharmony_ci * UI state of app-wide access and same life cycle as the app. 178561847f8eSopenharmony_ci * 178661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 178761847f8eSopenharmony_ci * @crossplatform 178861847f8eSopenharmony_ci * @form 178961847f8eSopenharmony_ci * @atomicservice 179061847f8eSopenharmony_ci * @since 11 179161847f8eSopenharmony_ci */ 179261847f8eSopenharmony_cideclare class LocalStorage { 179361847f8eSopenharmony_ci /** 179461847f8eSopenharmony_ci * Construct new instance of LocalStorage 179561847f8eSopenharmony_ci * initialize with all properties and their values that Object.keys(params) returns 179661847f8eSopenharmony_ci * Property values must not be undefined. 179761847f8eSopenharmony_ci * 179861847f8eSopenharmony_ci * @param { Object } [initializingProperties] - Object containing keys and values. see set() for valid values 179961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 180061847f8eSopenharmony_ci * @form 180161847f8eSopenharmony_ci * @since 9 180261847f8eSopenharmony_ci */ 180361847f8eSopenharmony_ci /** 180461847f8eSopenharmony_ci * Construct new instance of LocalStorage 180561847f8eSopenharmony_ci * initialize with all properties and their values that Object.keys(params) returns 180661847f8eSopenharmony_ci * Property values must not be undefined. 180761847f8eSopenharmony_ci * 180861847f8eSopenharmony_ci * @param { Object } [initializingProperties] - Object containing keys and values. see set() for valid values 180961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 181061847f8eSopenharmony_ci * @crossplatform 181161847f8eSopenharmony_ci * @form 181261847f8eSopenharmony_ci * @since 10 181361847f8eSopenharmony_ci */ 181461847f8eSopenharmony_ci /** 181561847f8eSopenharmony_ci * Construct new instance of LocalStorage 181661847f8eSopenharmony_ci * initialize with all properties and their values that Object.keys(params) returns 181761847f8eSopenharmony_ci * Property values must not be undefined. 181861847f8eSopenharmony_ci * 181961847f8eSopenharmony_ci * @param { Object } [initializingProperties] - Object containing keys and values. see set() for valid values 182061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 182161847f8eSopenharmony_ci * @crossplatform 182261847f8eSopenharmony_ci * @form 182361847f8eSopenharmony_ci * @atomicservice 182461847f8eSopenharmony_ci * @since 11 182561847f8eSopenharmony_ci */ 182661847f8eSopenharmony_ci constructor(initializingProperties?: Object); 182761847f8eSopenharmony_ci 182861847f8eSopenharmony_ci /** 182961847f8eSopenharmony_ci * Get current LocalStorage shared from stage. 183061847f8eSopenharmony_ci * 183161847f8eSopenharmony_ci * @returns { LocalStorage } 183261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 183361847f8eSopenharmony_ci * @StageModelOnly 183461847f8eSopenharmony_ci * @form 183561847f8eSopenharmony_ci * @since 9 183661847f8eSopenharmony_ci * @deprecated since 10 183761847f8eSopenharmony_ci * @useinstead LocalStorage#getShared 183861847f8eSopenharmony_ci */ 183961847f8eSopenharmony_ci static GetShared(): LocalStorage; 184061847f8eSopenharmony_ci 184161847f8eSopenharmony_ci /** 184261847f8eSopenharmony_ci * Get current LocalStorage shared from stage. 184361847f8eSopenharmony_ci * 184461847f8eSopenharmony_ci * @returns { LocalStorage } instance 184561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 184661847f8eSopenharmony_ci * @StageModelOnly 184761847f8eSopenharmony_ci * @crossplatform 184861847f8eSopenharmony_ci * @form 184961847f8eSopenharmony_ci * @since 10 185061847f8eSopenharmony_ci */ 185161847f8eSopenharmony_ci /** 185261847f8eSopenharmony_ci * Get current LocalStorage shared from stage. 185361847f8eSopenharmony_ci * 185461847f8eSopenharmony_ci * @returns { LocalStorage } instance 185561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 185661847f8eSopenharmony_ci * @StageModelOnly 185761847f8eSopenharmony_ci * @crossplatform 185861847f8eSopenharmony_ci * @form 185961847f8eSopenharmony_ci * @atomicservice 186061847f8eSopenharmony_ci * @since 11 186161847f8eSopenharmony_ci */ 186261847f8eSopenharmony_ci static getShared(): LocalStorage; 186361847f8eSopenharmony_ci 186461847f8eSopenharmony_ci /** 186561847f8eSopenharmony_ci * Obtain a handler or an alias to LocalStorage property with given name. 186661847f8eSopenharmony_ci * 186761847f8eSopenharmony_ci * @param { string } propName LocalStorage property name 186861847f8eSopenharmony_ci * @returns { AbstractProperty<T> | undefined } AbstractProperty object if property with given name exists 186961847f8eSopenharmony_ci * return undefined otherwise. 187061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 187161847f8eSopenharmony_ci * @crossplatform 187261847f8eSopenharmony_ci * @atomicservice 187361847f8eSopenharmony_ci * @since 12 187461847f8eSopenharmony_ci */ 187561847f8eSopenharmony_ci public ref<T>(propName: string): AbstractProperty<T> | undefined; 187661847f8eSopenharmony_ci 187761847f8eSopenharmony_ci /** 187861847f8eSopenharmony_ci * Obtain a handler or an alias to LocalStorage property with given name. 187961847f8eSopenharmony_ci * 188061847f8eSopenharmony_ci * If property does not exist in LocalStorage, create it with given default value. 188161847f8eSopenharmony_ci * 188261847f8eSopenharmony_ci * @param { string } propName LocalStorage property name 188361847f8eSopenharmony_ci * @param { T } defaultValue If property does not exist in LocalStorage, 188461847f8eSopenharmony_ci * create it with given default value. 188561847f8eSopenharmony_ci * @returns { AbstractProperty<T> } AbstractProperty object 188661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 188761847f8eSopenharmony_ci * @crossplatform 188861847f8eSopenharmony_ci * @atomicservice 188961847f8eSopenharmony_ci * @since 12 189061847f8eSopenharmony_ci */ 189161847f8eSopenharmony_ci public setAndRef<T>(propName: string, defaultValue: T): AbstractProperty<T>; 189261847f8eSopenharmony_ci 189361847f8eSopenharmony_ci /** 189461847f8eSopenharmony_ci * Check if LocalStorage has a property with given name 189561847f8eSopenharmony_ci * return true if property with given name exists 189661847f8eSopenharmony_ci * same as ES6 Map.prototype.has() 189761847f8eSopenharmony_ci * 189861847f8eSopenharmony_ci * @param { string } propName - searched property 189961847f8eSopenharmony_ci * @returns { boolean } true if property with such name exists in LocalStorage 190061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 190161847f8eSopenharmony_ci * @form 190261847f8eSopenharmony_ci * @since 9 190361847f8eSopenharmony_ci */ 190461847f8eSopenharmony_ci /** 190561847f8eSopenharmony_ci * Check if LocalStorage has a property with given name 190661847f8eSopenharmony_ci * return true if property with given name exists 190761847f8eSopenharmony_ci * same as ES6 Map.prototype.has() 190861847f8eSopenharmony_ci * 190961847f8eSopenharmony_ci * @param { string } propName - searched property 191061847f8eSopenharmony_ci * @returns { boolean } true if property with such name exists in LocalStorage 191161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 191261847f8eSopenharmony_ci * @crossplatform 191361847f8eSopenharmony_ci * @form 191461847f8eSopenharmony_ci * @since 10 191561847f8eSopenharmony_ci */ 191661847f8eSopenharmony_ci /** 191761847f8eSopenharmony_ci * Check if LocalStorage has a property with given name 191861847f8eSopenharmony_ci * return true if property with given name exists 191961847f8eSopenharmony_ci * same as ES6 Map.prototype.has() 192061847f8eSopenharmony_ci * 192161847f8eSopenharmony_ci * @param { string } propName - searched property 192261847f8eSopenharmony_ci * @returns { boolean } true if property with such name exists in LocalStorage 192361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 192461847f8eSopenharmony_ci * @crossplatform 192561847f8eSopenharmony_ci * @form 192661847f8eSopenharmony_ci * @atomicservice 192761847f8eSopenharmony_ci * @since 11 192861847f8eSopenharmony_ci */ 192961847f8eSopenharmony_ci has(propName: string): boolean; 193061847f8eSopenharmony_ci 193161847f8eSopenharmony_ci /** 193261847f8eSopenharmony_ci * Provide names of all properties in LocalStorage 193361847f8eSopenharmony_ci * same as ES6 Map.prototype.keys() 193461847f8eSopenharmony_ci * 193561847f8eSopenharmony_ci * @returns { IterableIterator<string> } return a Map Iterator 193661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 193761847f8eSopenharmony_ci * @form 193861847f8eSopenharmony_ci * @since 9 193961847f8eSopenharmony_ci */ 194061847f8eSopenharmony_ci /** 194161847f8eSopenharmony_ci * Provide names of all properties in LocalStorage 194261847f8eSopenharmony_ci * same as ES6 Map.prototype.keys() 194361847f8eSopenharmony_ci * 194461847f8eSopenharmony_ci * @returns { IterableIterator<string> } return a Map Iterator 194561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 194661847f8eSopenharmony_ci * @crossplatform 194761847f8eSopenharmony_ci * @form 194861847f8eSopenharmony_ci * @since 10 194961847f8eSopenharmony_ci */ 195061847f8eSopenharmony_ci /** 195161847f8eSopenharmony_ci * Provide names of all properties in LocalStorage 195261847f8eSopenharmony_ci * same as ES6 Map.prototype.keys() 195361847f8eSopenharmony_ci * 195461847f8eSopenharmony_ci * @returns { IterableIterator<string> } return a Map Iterator 195561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 195661847f8eSopenharmony_ci * @crossplatform 195761847f8eSopenharmony_ci * @form 195861847f8eSopenharmony_ci * @atomicservice 195961847f8eSopenharmony_ci * @since 11 196061847f8eSopenharmony_ci */ 196161847f8eSopenharmony_ci keys(): IterableIterator<string>; 196261847f8eSopenharmony_ci 196361847f8eSopenharmony_ci /** 196461847f8eSopenharmony_ci * Returns number of properties in LocalStorage 196561847f8eSopenharmony_ci * same as Map.prototype.size() 196661847f8eSopenharmony_ci * 196761847f8eSopenharmony_ci * @returns { number } return number of properties 196861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 196961847f8eSopenharmony_ci * @form 197061847f8eSopenharmony_ci * @since 9 197161847f8eSopenharmony_ci */ 197261847f8eSopenharmony_ci /** 197361847f8eSopenharmony_ci * Returns number of properties in LocalStorage 197461847f8eSopenharmony_ci * same as Map.prototype.size() 197561847f8eSopenharmony_ci * 197661847f8eSopenharmony_ci * @returns { number } return number of properties 197761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 197861847f8eSopenharmony_ci * @crossplatform 197961847f8eSopenharmony_ci * @form 198061847f8eSopenharmony_ci * @since 10 198161847f8eSopenharmony_ci */ 198261847f8eSopenharmony_ci /** 198361847f8eSopenharmony_ci * Returns number of properties in LocalStorage 198461847f8eSopenharmony_ci * same as Map.prototype.size() 198561847f8eSopenharmony_ci * 198661847f8eSopenharmony_ci * @returns { number } return number of properties 198761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 198861847f8eSopenharmony_ci * @crossplatform 198961847f8eSopenharmony_ci * @form 199061847f8eSopenharmony_ci * @atomicservice 199161847f8eSopenharmony_ci * @since 11 199261847f8eSopenharmony_ci */ 199361847f8eSopenharmony_ci size(): number; 199461847f8eSopenharmony_ci 199561847f8eSopenharmony_ci /** 199661847f8eSopenharmony_ci * Returns value of given property 199761847f8eSopenharmony_ci * return undefined if no property with this name 199861847f8eSopenharmony_ci * 199961847f8eSopenharmony_ci * @param { string } propName 200061847f8eSopenharmony_ci * @returns { T | undefined } property value if found or undefined 200161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 200261847f8eSopenharmony_ci * @form 200361847f8eSopenharmony_ci * @since 9 200461847f8eSopenharmony_ci */ 200561847f8eSopenharmony_ci /** 200661847f8eSopenharmony_ci * Returns value of given property 200761847f8eSopenharmony_ci * return undefined if no property with this name 200861847f8eSopenharmony_ci * 200961847f8eSopenharmony_ci * @param { string } propName 201061847f8eSopenharmony_ci * @returns { T | undefined } property value if found or undefined 201161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 201261847f8eSopenharmony_ci * @crossplatform 201361847f8eSopenharmony_ci * @form 201461847f8eSopenharmony_ci * @since 10 201561847f8eSopenharmony_ci */ 201661847f8eSopenharmony_ci /** 201761847f8eSopenharmony_ci * Returns value of given property 201861847f8eSopenharmony_ci * return undefined if no property with this name 201961847f8eSopenharmony_ci * 202061847f8eSopenharmony_ci * @param { string } propName 202161847f8eSopenharmony_ci * @returns { T | undefined } property value if found or undefined 202261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 202361847f8eSopenharmony_ci * @crossplatform 202461847f8eSopenharmony_ci * @form 202561847f8eSopenharmony_ci * @atomicservice 202661847f8eSopenharmony_ci * @since 11 202761847f8eSopenharmony_ci */ 202861847f8eSopenharmony_ci get<T>(propName: string): T | undefined; 202961847f8eSopenharmony_ci 203061847f8eSopenharmony_ci /** 203161847f8eSopenharmony_ci * Set value of given property in LocalStorage 203261847f8eSopenharmony_ci * Method sets nothing and returns false if property with this name does not exist 203361847f8eSopenharmony_ci * or if newValue is `undefined` or `null` (`undefined`, `null` value are not allowed for state variables). 203461847f8eSopenharmony_ci * 203561847f8eSopenharmony_ci * @param { string } propName 203661847f8eSopenharmony_ci * @param { T } newValue - must be of type T and must not be undefined or null 203761847f8eSopenharmony_ci * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false 203861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 203961847f8eSopenharmony_ci * @form 204061847f8eSopenharmony_ci * @since 9 204161847f8eSopenharmony_ci */ 204261847f8eSopenharmony_ci /** 204361847f8eSopenharmony_ci * Set value of given property in LocalStorage 204461847f8eSopenharmony_ci * Method sets nothing and returns false if property with this name does not exist 204561847f8eSopenharmony_ci * or if newValue is `undefined` or `null` (`undefined`, `null` value are not allowed for state variables). 204661847f8eSopenharmony_ci * 204761847f8eSopenharmony_ci * @param { string } propName 204861847f8eSopenharmony_ci * @param { T } newValue - must be of type T and must not be undefined or null 204961847f8eSopenharmony_ci * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false 205061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 205161847f8eSopenharmony_ci * @crossplatform 205261847f8eSopenharmony_ci * @form 205361847f8eSopenharmony_ci * @since 10 205461847f8eSopenharmony_ci */ 205561847f8eSopenharmony_ci /** 205661847f8eSopenharmony_ci * Set value of given property in LocalStorage 205761847f8eSopenharmony_ci * Method sets nothing and returns false if property with this name does not exist 205861847f8eSopenharmony_ci * or if newValue is `undefined` or `null` (`undefined`, `null` value are not allowed for state variables). 205961847f8eSopenharmony_ci * 206061847f8eSopenharmony_ci * @param { string } propName 206161847f8eSopenharmony_ci * @param { T } newValue - must be of type T and must not be undefined or null 206261847f8eSopenharmony_ci * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false 206361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 206461847f8eSopenharmony_ci * @crossplatform 206561847f8eSopenharmony_ci * @form 206661847f8eSopenharmony_ci * @atomicservice 206761847f8eSopenharmony_ci * @since 11 206861847f8eSopenharmony_ci */ 206961847f8eSopenharmony_ci /** 207061847f8eSopenharmony_ci * Set value of given property in LocalStorage 207161847f8eSopenharmony_ci * Method sets nothing and returns false if property with this name does not exist in LocalStorage 207261847f8eSopenharmony_ci * newValue can be undefined or null from API 12. 207361847f8eSopenharmony_ci * 207461847f8eSopenharmony_ci * @param { string } propName 207561847f8eSopenharmony_ci * @param { T } newValue - must be of type T, can be undefined or null 207661847f8eSopenharmony_ci * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false 207761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 207861847f8eSopenharmony_ci * @crossplatform 207961847f8eSopenharmony_ci * @form 208061847f8eSopenharmony_ci * @atomicservice 208161847f8eSopenharmony_ci * @since 12 208261847f8eSopenharmony_ci */ 208361847f8eSopenharmony_ci set<T>(propName: string, newValue: T): boolean; 208461847f8eSopenharmony_ci 208561847f8eSopenharmony_ci /** 208661847f8eSopenharmony_ci * Set value of given property, if it exists, see set() . 208761847f8eSopenharmony_ci * Add property if no property with given name and initialize with given value. 208861847f8eSopenharmony_ci * Do nothing and return false if newValue is undefined or null 208961847f8eSopenharmony_ci * (undefined, null value is not allowed for state variables) 209061847f8eSopenharmony_ci * 209161847f8eSopenharmony_ci * @param { string } propName 209261847f8eSopenharmony_ci * @param { T } newValue - must be of type T and must not be undefined or null 209361847f8eSopenharmony_ci * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false 209461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 209561847f8eSopenharmony_ci * @form 209661847f8eSopenharmony_ci * @since 9 209761847f8eSopenharmony_ci */ 209861847f8eSopenharmony_ci /** 209961847f8eSopenharmony_ci * Set value of given property, if it exists, see set() . 210061847f8eSopenharmony_ci * Add property if no property with given name and initialize with given value. 210161847f8eSopenharmony_ci * Do nothing and return false if newValue is undefined or null 210261847f8eSopenharmony_ci * (undefined, null value is not allowed for state variables) 210361847f8eSopenharmony_ci * 210461847f8eSopenharmony_ci * @param { string } propName 210561847f8eSopenharmony_ci * @param { T } newValue - must be of type T and must not be undefined or null 210661847f8eSopenharmony_ci * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false 210761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 210861847f8eSopenharmony_ci * @crossplatform 210961847f8eSopenharmony_ci * @form 211061847f8eSopenharmony_ci * @since 10 211161847f8eSopenharmony_ci */ 211261847f8eSopenharmony_ci /** 211361847f8eSopenharmony_ci * Set value of given property, if it exists, see set() . 211461847f8eSopenharmony_ci * Add property if no property with given name and initialize with given value. 211561847f8eSopenharmony_ci * Do nothing and return false if newValue is undefined or null 211661847f8eSopenharmony_ci * (undefined, null value is not allowed for state variables) 211761847f8eSopenharmony_ci * 211861847f8eSopenharmony_ci * @param { string } propName 211961847f8eSopenharmony_ci * @param { T } newValue - must be of type T and must not be undefined or null 212061847f8eSopenharmony_ci * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false 212161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 212261847f8eSopenharmony_ci * @crossplatform 212361847f8eSopenharmony_ci * @form 212461847f8eSopenharmony_ci * @atomicservice 212561847f8eSopenharmony_ci * @since 11 212661847f8eSopenharmony_ci */ 212761847f8eSopenharmony_ci /** 212861847f8eSopenharmony_ci * Set value of given property, if it exists, see set() . 212961847f8eSopenharmony_ci * Add property if no property with given name and initialize with given value. 213061847f8eSopenharmony_ci * newValue can be undefined or null from API 12 213161847f8eSopenharmony_ci * 213261847f8eSopenharmony_ci * @param { string } propName 213361847f8eSopenharmony_ci * @param { T } newValue - must be of type T, can be undefined or null 213461847f8eSopenharmony_ci * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false 213561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 213661847f8eSopenharmony_ci * @crossplatform 213761847f8eSopenharmony_ci * @form 213861847f8eSopenharmony_ci * @atomicservice 213961847f8eSopenharmony_ci * @since 12 214061847f8eSopenharmony_ci */ 214161847f8eSopenharmony_ci setOrCreate<T>(propName: string, newValue: T): boolean; 214261847f8eSopenharmony_ci 214361847f8eSopenharmony_ci /** 214461847f8eSopenharmony_ci * Create and return a two-way sync "(link") to named property 214561847f8eSopenharmony_ci * 214661847f8eSopenharmony_ci * @param { string } propName - name of source property in LocalStorage 214761847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<T> } instance of SubscribedAbstractProperty<T> 214861847f8eSopenharmony_ci * return undefined if named property does not already exist in LocalStorage 214961847f8eSopenharmony_ci * Apps can use SDK functions of base class SubscribedPropertyAbstract<T> 215061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 215161847f8eSopenharmony_ci * @form 215261847f8eSopenharmony_ci * @since 9 215361847f8eSopenharmony_ci */ 215461847f8eSopenharmony_ci /** 215561847f8eSopenharmony_ci * Create and return a two-way sync "(link") to named property 215661847f8eSopenharmony_ci * 215761847f8eSopenharmony_ci * @param { string } propName - name of source property in LocalStorage 215861847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<T> } instance of SubscribedAbstractProperty<T> 215961847f8eSopenharmony_ci * return undefined if named property does not already exist in LocalStorage 216061847f8eSopenharmony_ci * Apps can use SDK functions of base class SubscribedPropertyAbstract<T> 216161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 216261847f8eSopenharmony_ci * @crossplatform 216361847f8eSopenharmony_ci * @form 216461847f8eSopenharmony_ci * @since 10 216561847f8eSopenharmony_ci */ 216661847f8eSopenharmony_ci /** 216761847f8eSopenharmony_ci * Create and return a two-way sync "(link") to named property 216861847f8eSopenharmony_ci * 216961847f8eSopenharmony_ci * @param { string } propName - name of source property in LocalStorage 217061847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<T> } instance of SubscribedAbstractProperty<T> 217161847f8eSopenharmony_ci * return undefined if named property does not already exist in LocalStorage 217261847f8eSopenharmony_ci * Apps can use SDK functions of base class SubscribedPropertyAbstract<T> 217361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 217461847f8eSopenharmony_ci * @crossplatform 217561847f8eSopenharmony_ci * @form 217661847f8eSopenharmony_ci * @atomicservice 217761847f8eSopenharmony_ci * @since 11 217861847f8eSopenharmony_ci */ 217961847f8eSopenharmony_ci link<T>(propName: string): SubscribedAbstractProperty<T>; 218061847f8eSopenharmony_ci 218161847f8eSopenharmony_ci /** 218261847f8eSopenharmony_ci * Like see link(), but will create and initialize a new source property in LocalStorage if missing 218361847f8eSopenharmony_ci * 218461847f8eSopenharmony_ci * @param { string } propName - name of source property in LocalStorage 218561847f8eSopenharmony_ci * @param { T } defaultValue - value to be used for initializing if new creating new property in LocalStorage 218661847f8eSopenharmony_ci * default value must be of type T, must not be undefined or null. 218761847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<T> } instance of SubscribedAbstractProperty<T> 218861847f8eSopenharmony_ci * Apps can use SDK functions of base class SubscribedAbstractProperty<T> 218961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 219061847f8eSopenharmony_ci * @form 219161847f8eSopenharmony_ci * @since 9 219261847f8eSopenharmony_ci */ 219361847f8eSopenharmony_ci /** 219461847f8eSopenharmony_ci * Like see link(), but will create and initialize a new source property in LocalStorage if missing 219561847f8eSopenharmony_ci * 219661847f8eSopenharmony_ci * @param { string } propName - name of source property in LocalStorage 219761847f8eSopenharmony_ci * @param { T } defaultValue - value to be used for initializing if new creating new property in LocalStorage 219861847f8eSopenharmony_ci * default value must be of type T, must not be undefined or null. 219961847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<T> } instance of SubscribedAbstractProperty<T> 220061847f8eSopenharmony_ci * Apps can use SDK functions of base class SubscribedAbstractProperty<T> 220161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 220261847f8eSopenharmony_ci * @crossplatform 220361847f8eSopenharmony_ci * @form 220461847f8eSopenharmony_ci * @since 10 220561847f8eSopenharmony_ci */ 220661847f8eSopenharmony_ci /** 220761847f8eSopenharmony_ci * Like see link(), but will create and initialize a new source property in LocalStorage if missing 220861847f8eSopenharmony_ci * 220961847f8eSopenharmony_ci * @param { string } propName - name of source property in LocalStorage 221061847f8eSopenharmony_ci * @param { T } defaultValue - value to be used for initializing if new creating new property in LocalStorage 221161847f8eSopenharmony_ci * default value must be of type T, must not be undefined or null. 221261847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<T> } instance of SubscribedAbstractProperty<T> 221361847f8eSopenharmony_ci * Apps can use SDK functions of base class SubscribedAbstractProperty<T> 221461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 221561847f8eSopenharmony_ci * @crossplatform 221661847f8eSopenharmony_ci * @form 221761847f8eSopenharmony_ci * @atomicservice 221861847f8eSopenharmony_ci * @since 11 221961847f8eSopenharmony_ci */ 222061847f8eSopenharmony_ci /** 222161847f8eSopenharmony_ci * Like see link(), but will create and initialize a new source property in LocalStorage if missing 222261847f8eSopenharmony_ci * 222361847f8eSopenharmony_ci * @param { string } propName - name of source property in LocalStorage 222461847f8eSopenharmony_ci * @param { T } defaultValue - value to be used for initializing new property in LocalStorage 222561847f8eSopenharmony_ci * default value must be of type T, can be undefined or null. 222661847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<T> } instance of SubscribedAbstractProperty<T> 222761847f8eSopenharmony_ci * Apps can use SDK functions of base class SubscribedAbstractProperty<T> 222861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 222961847f8eSopenharmony_ci * @crossplatform 223061847f8eSopenharmony_ci * @form 223161847f8eSopenharmony_ci * @atomicservice 223261847f8eSopenharmony_ci * @since 12 223361847f8eSopenharmony_ci */ 223461847f8eSopenharmony_ci setAndLink<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T>; 223561847f8eSopenharmony_ci 223661847f8eSopenharmony_ci /** 223761847f8eSopenharmony_ci * Create and return a one-way sync ('prop') to named property 223861847f8eSopenharmony_ci * 223961847f8eSopenharmony_ci * @param { string } propName - name of source property in LocalStorage 224061847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<S> } instance of SubscribedAbstractProperty<S> 224161847f8eSopenharmony_ci * return undefined if named property does not already exist in LocalStorage 224261847f8eSopenharmony_ci * Apps can use SDK functions of base class SubscribedAbstractProperty<S> 224361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 224461847f8eSopenharmony_ci * @form 224561847f8eSopenharmony_ci * @since 9 224661847f8eSopenharmony_ci */ 224761847f8eSopenharmony_ci /** 224861847f8eSopenharmony_ci * Create and return a one-way sync ('prop') to named property 224961847f8eSopenharmony_ci * 225061847f8eSopenharmony_ci * @param { string } propName - name of source property in LocalStorage 225161847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<S> } instance of SubscribedAbstractProperty<S> 225261847f8eSopenharmony_ci * return undefined if named property does not already exist in LocalStorage 225361847f8eSopenharmony_ci * Apps can use SDK functions of base class SubscribedAbstractProperty<S> 225461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 225561847f8eSopenharmony_ci * @crossplatform 225661847f8eSopenharmony_ci * @form 225761847f8eSopenharmony_ci * @since 10 225861847f8eSopenharmony_ci */ 225961847f8eSopenharmony_ci /** 226061847f8eSopenharmony_ci * Create and return a one-way sync ('prop') to named property 226161847f8eSopenharmony_ci * 226261847f8eSopenharmony_ci * @param { string } propName - name of source property in LocalStorage 226361847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<S> } instance of SubscribedAbstractProperty<S> 226461847f8eSopenharmony_ci * return undefined if named property does not already exist in LocalStorage 226561847f8eSopenharmony_ci * Apps can use SDK functions of base class SubscribedAbstractProperty<S> 226661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 226761847f8eSopenharmony_ci * @crossplatform 226861847f8eSopenharmony_ci * @form 226961847f8eSopenharmony_ci * @atomicservice 227061847f8eSopenharmony_ci * @since 11 227161847f8eSopenharmony_ci */ 227261847f8eSopenharmony_ci prop<S>(propName: string): SubscribedAbstractProperty<S>; 227361847f8eSopenharmony_ci 227461847f8eSopenharmony_ci /** 227561847f8eSopenharmony_ci * Like see prop(), will create and initialize a new source property in LocalStorage if missing 227661847f8eSopenharmony_ci * 227761847f8eSopenharmony_ci * @param { string } propName - name of source property in LocalStorage 227861847f8eSopenharmony_ci * @param { S } defaultValue - value to be used for initializing if new creating new property in LocalStorage. 227961847f8eSopenharmony_ci * Default value must be of type T, must not be undefined or null. 228061847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<S> } instance of SubscribedAbstractProperty<S> 228161847f8eSopenharmony_ci * Apps can use SDK functions of base class SubscribedAbstractProperty<S> 228261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 228361847f8eSopenharmony_ci * @form 228461847f8eSopenharmony_ci * @since 9 228561847f8eSopenharmony_ci */ 228661847f8eSopenharmony_ci /** 228761847f8eSopenharmony_ci * Like see prop(), will create and initialize a new source property in LocalStorage if missing 228861847f8eSopenharmony_ci * 228961847f8eSopenharmony_ci * @param { string } propName - name of source property in LocalStorage 229061847f8eSopenharmony_ci * @param { S } defaultValue - value to be used for initializing if new creating new property in LocalStorage. 229161847f8eSopenharmony_ci * Default value must be of type T, must not be undefined or null. 229261847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<S> } instance of SubscribedAbstractProperty<S> 229361847f8eSopenharmony_ci * Apps can use SDK functions of base class SubscribedAbstractProperty<S> 229461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 229561847f8eSopenharmony_ci * @crossplatform 229661847f8eSopenharmony_ci * @form 229761847f8eSopenharmony_ci * @since 10 229861847f8eSopenharmony_ci */ 229961847f8eSopenharmony_ci /** 230061847f8eSopenharmony_ci * Like see prop(), will create and initialize a new source property in LocalStorage if missing 230161847f8eSopenharmony_ci * 230261847f8eSopenharmony_ci * @param { string } propName - name of source property in LocalStorage 230361847f8eSopenharmony_ci * @param { S } defaultValue - value to be used for initializing if new creating new property in LocalStorage. 230461847f8eSopenharmony_ci * Default value must be of type T, must not be undefined or null. 230561847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<S> } instance of SubscribedAbstractProperty<S> 230661847f8eSopenharmony_ci * Apps can use SDK functions of base class SubscribedAbstractProperty<S> 230761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 230861847f8eSopenharmony_ci * @crossplatform 230961847f8eSopenharmony_ci * @form 231061847f8eSopenharmony_ci * @atomicservice 231161847f8eSopenharmony_ci * @since 11 231261847f8eSopenharmony_ci */ 231361847f8eSopenharmony_ci /** 231461847f8eSopenharmony_ci * Like see prop(), will create and initialize a new source property in LocalStorage if missing 231561847f8eSopenharmony_ci * 231661847f8eSopenharmony_ci * @param { string } propName - name of source property in LocalStorage 231761847f8eSopenharmony_ci * @param { S } defaultValue - value to be used for initializing new property in LocalStorage. 231861847f8eSopenharmony_ci * Default value must be of type T, can be undefined or null. 231961847f8eSopenharmony_ci * @returns { SubscribedAbstractProperty<S> } instance of SubscribedAbstractProperty<S> 232061847f8eSopenharmony_ci * Apps can use SDK functions of base class SubscribedAbstractProperty<S> 232161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 232261847f8eSopenharmony_ci * @crossplatform 232361847f8eSopenharmony_ci * @form 232461847f8eSopenharmony_ci * @atomicservice 232561847f8eSopenharmony_ci * @since 12 232661847f8eSopenharmony_ci */ 232761847f8eSopenharmony_ci setAndProp<S>(propName: string, defaultValue: S): SubscribedAbstractProperty<S>; 232861847f8eSopenharmony_ci 232961847f8eSopenharmony_ci /** 233061847f8eSopenharmony_ci * Delete property from StorageBase 233161847f8eSopenharmony_ci * Use with caution: 233261847f8eSopenharmony_ci * Before deleting a prop from LocalStorage all its subscribers need to 233361847f8eSopenharmony_ci * unsubscribe from the property. 233461847f8eSopenharmony_ci * This method fails and returns false if given property still has subscribers 233561847f8eSopenharmony_ci * Another reason for failing is unknown property. 233661847f8eSopenharmony_ci * Developer advise: 233761847f8eSopenharmony_ci * Subscribers are created with see link(), see prop() 233861847f8eSopenharmony_ci * and also via @LocalStorageLink and @LocalStorageProp state variable decorators. 233961847f8eSopenharmony_ci * That means as long as their is a @Component instance that uses such decorated variable 234061847f8eSopenharmony_ci * or a sync relationship with a SubscribedAbstractProperty variable the property can nit 234161847f8eSopenharmony_ci * (and also should not!) be deleted from LocalStorage. 234261847f8eSopenharmony_ci * 234361847f8eSopenharmony_ci * @param { string } propName 234461847f8eSopenharmony_ci * @returns { boolean } false if method failed 234561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 234661847f8eSopenharmony_ci * @form 234761847f8eSopenharmony_ci * @since 9 234861847f8eSopenharmony_ci */ 234961847f8eSopenharmony_ci /** 235061847f8eSopenharmony_ci * Delete property from StorageBase 235161847f8eSopenharmony_ci * Use with caution: 235261847f8eSopenharmony_ci * Before deleting a prop from LocalStorage all its subscribers need to 235361847f8eSopenharmony_ci * unsubscribe from the property. 235461847f8eSopenharmony_ci * This method fails and returns false if given property still has subscribers 235561847f8eSopenharmony_ci * Another reason for failing is unknown property. 235661847f8eSopenharmony_ci * Developer advise: 235761847f8eSopenharmony_ci * Subscribers are created with see link(), see prop() 235861847f8eSopenharmony_ci * and also via @LocalStorageLink and @LocalStorageProp state variable decorators. 235961847f8eSopenharmony_ci * That means as long as their is a @Component instance that uses such decorated variable 236061847f8eSopenharmony_ci * or a sync relationship with a SubscribedAbstractProperty variable the property can nit 236161847f8eSopenharmony_ci * (and also should not!) be deleted from LocalStorage. 236261847f8eSopenharmony_ci * 236361847f8eSopenharmony_ci * @param { string } propName 236461847f8eSopenharmony_ci * @returns { boolean } false if method failed 236561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 236661847f8eSopenharmony_ci * @crossplatform 236761847f8eSopenharmony_ci * @form 236861847f8eSopenharmony_ci * @since 10 236961847f8eSopenharmony_ci */ 237061847f8eSopenharmony_ci /** 237161847f8eSopenharmony_ci * Delete property from StorageBase 237261847f8eSopenharmony_ci * Use with caution: 237361847f8eSopenharmony_ci * Before deleting a prop from LocalStorage all its subscribers need to 237461847f8eSopenharmony_ci * unsubscribe from the property. 237561847f8eSopenharmony_ci * This method fails and returns false if given property still has subscribers 237661847f8eSopenharmony_ci * Another reason for failing is unknown property. 237761847f8eSopenharmony_ci * Developer advise: 237861847f8eSopenharmony_ci * Subscribers are created with see link(), see prop() 237961847f8eSopenharmony_ci * and also via @LocalStorageLink and @LocalStorageProp state variable decorators. 238061847f8eSopenharmony_ci * That means as long as their is a @Component instance that uses such decorated variable 238161847f8eSopenharmony_ci * or a sync relationship with a SubscribedAbstractProperty variable the property can nit 238261847f8eSopenharmony_ci * (and also should not!) be deleted from LocalStorage. 238361847f8eSopenharmony_ci * 238461847f8eSopenharmony_ci * @param { string } propName 238561847f8eSopenharmony_ci * @returns { boolean } false if method failed 238661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 238761847f8eSopenharmony_ci * @crossplatform 238861847f8eSopenharmony_ci * @form 238961847f8eSopenharmony_ci * @atomicservice 239061847f8eSopenharmony_ci * @since 11 239161847f8eSopenharmony_ci */ 239261847f8eSopenharmony_ci delete(propName: string): boolean; 239361847f8eSopenharmony_ci 239461847f8eSopenharmony_ci /** 239561847f8eSopenharmony_ci * Delete all properties from the LocalStorage instance 239661847f8eSopenharmony_ci * Precondition is that there are no subscribers. 239761847f8eSopenharmony_ci * method returns false and deletes no properties if there is any property 239861847f8eSopenharmony_ci * that still has subscribers 239961847f8eSopenharmony_ci * 240061847f8eSopenharmony_ci * @returns { boolean } 240161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 240261847f8eSopenharmony_ci * @form 240361847f8eSopenharmony_ci * @since 9 240461847f8eSopenharmony_ci */ 240561847f8eSopenharmony_ci /** 240661847f8eSopenharmony_ci * Delete all properties from the LocalStorage instance 240761847f8eSopenharmony_ci * Precondition is that there are no subscribers. 240861847f8eSopenharmony_ci * method returns false and deletes no properties if there is any property 240961847f8eSopenharmony_ci * that still has subscribers 241061847f8eSopenharmony_ci * 241161847f8eSopenharmony_ci * @returns { boolean } 241261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 241361847f8eSopenharmony_ci * @crossplatform 241461847f8eSopenharmony_ci * @form 241561847f8eSopenharmony_ci * @since 10 241661847f8eSopenharmony_ci */ 241761847f8eSopenharmony_ci /** 241861847f8eSopenharmony_ci * Delete all properties from the LocalStorage instance 241961847f8eSopenharmony_ci * Precondition is that there are no subscribers. 242061847f8eSopenharmony_ci * method returns false and deletes no properties if there is any property 242161847f8eSopenharmony_ci * that still has subscribers 242261847f8eSopenharmony_ci * 242361847f8eSopenharmony_ci * @returns { boolean } 242461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 242561847f8eSopenharmony_ci * @crossplatform 242661847f8eSopenharmony_ci * @form 242761847f8eSopenharmony_ci * @atomicservice 242861847f8eSopenharmony_ci * @since 11 242961847f8eSopenharmony_ci */ 243061847f8eSopenharmony_ci clear(): boolean; 243161847f8eSopenharmony_ci} 2432