From dfda472e501c1af62f569aa8874d05960755416c Mon Sep 17 00:00:00 2001 From: chenbenzhi Date: Wed, 6 Aug 2025 17:57:48 +0800 Subject: [PATCH] stateMgmt 1.2 api modify Signed-off-by: chenbenzhi --- .../component/ets/state_management.d.ts | 37 +- api/@ohos.arkui.component.d.ets | 1 - ... @ohos.arkui.stateManagement.static.d.ets} | 1 + .../{builder.d.ets => builder.static.d.ets} | 1 + ...ent.d.ets => customComponent.static.d.ets} | 1 + ...d.ets => extendableComponent.static.d.ets} | 1 + api/arkui/component/interop.static.d.ets | 1 + ...decorator.d.ets => decorator.static.d.ets} | 1 + .../stateManagement/remember.static.d.ets | 1 + .../{runtime.d.ets => runtime.static.d.ets} | 1 + ...pStorage.d.ets => appStorage.static.d.ets} | 1 + ...ronment.d.ets => environment.static.d.ets} | 1 + ...torage.d.ets => localStorage.static.d.ets} | 379 +++++++++--------- ...e.d.ets => persistentStorage.static.d.ets} | 1 + ...rty.d.ets => storageProperty.static.d.ets} | 1 + .../{utils.d.ets => utils.static.d.ets} | 1 + 16 files changed, 215 insertions(+), 215 deletions(-) rename api/{@ohos.arkui.stateManagement.d.ets => @ohos.arkui.stateManagement.static.d.ets} (96%) rename api/arkui/component/{builder.d.ets => builder.static.d.ets} (95%) rename api/arkui/component/{customComponent.d.ets => customComponent.static.d.ets} (99%) rename api/arkui/component/{extendableComponent.d.ets => extendableComponent.static.d.ets} (99%) rename api/arkui/stateManagement/{decorator.d.ets => decorator.static.d.ets} (99%) rename api/arkui/stateManagement/{runtime.d.ets => runtime.static.d.ets} (99%) rename api/arkui/stateManagement/storage/{appStorage.d.ets => appStorage.static.d.ets} (98%) rename api/arkui/stateManagement/storage/{environment.d.ets => environment.static.d.ets} (99%) rename api/arkui/stateManagement/storage/{localStorage.d.ets => localStorage.static.d.ets} (97%) rename api/arkui/stateManagement/storage/{persistentStorage.d.ets => persistentStorage.static.d.ets} (99%) rename api/arkui/stateManagement/storage/{storageProperty.d.ets => storageProperty.static.d.ets} (96%) rename api/arkui/stateManagement/{utils.d.ets => utils.static.d.ets} (96%) diff --git a/api/@internal/component/ets/state_management.d.ts b/api/@internal/component/ets/state_management.d.ts index 9edb4e29fa..8fa2bcf540 100644 --- a/api/@internal/component/ets/state_management.d.ts +++ b/api/@internal/component/ets/state_management.d.ts @@ -31,8 +31,7 @@ * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ declare enum ColorMode { /** @@ -46,8 +45,7 @@ declare enum ColorMode { * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ LIGHT = 0, @@ -62,8 +60,7 @@ declare enum ColorMode { * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ DARK, } @@ -81,8 +78,7 @@ declare enum ColorMode { * @enum { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ declare enum LayoutDirection { /** @@ -96,8 +92,7 @@ declare enum LayoutDirection { * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ LTR, @@ -112,8 +107,7 @@ declare enum LayoutDirection { * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ RTL, @@ -128,8 +122,7 @@ declare enum LayoutDirection { * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'11','1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ Auto, } @@ -139,8 +132,7 @@ declare enum LayoutDirection { * * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'7','1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 */ declare class Storage { /** @@ -150,8 +142,7 @@ declare class Storage { * @param { string } file * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'7','1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 */ constructor(needCrossThread?: boolean, file?: string); @@ -162,8 +153,7 @@ declare class Storage { * @returns { string | undefined } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'7','1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 */ get(key: string): string | undefined; @@ -186,7 +176,6 @@ declare class Storage { * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi * @since 20 - * @arkts 1.2 */ set(key: string, val: Object | undefined | null): void; @@ -195,8 +184,7 @@ declare class Storage { * * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'7','1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 */ clear(): void; @@ -206,8 +194,7 @@ declare class Storage { * @param { string } key * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'7','1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 */ delete(key: string): void; } diff --git a/api/@ohos.arkui.component.d.ets b/api/@ohos.arkui.component.d.ets index f03f302f76..461b86ba7a 100644 --- a/api/@ohos.arkui.component.d.ets +++ b/api/@ohos.arkui.component.d.ets @@ -126,7 +126,6 @@ export * from './arkui/component/sidebar'; export * from './arkui/component/slider'; export * from './arkui/component/span'; export * from './arkui/component/stack'; -export * from './arkui/component/stateManagement'; export * from './arkui/component/stepper'; export * from './arkui/component/stepperItem'; export * from './arkui/component/styledString'; diff --git a/api/@ohos.arkui.stateManagement.d.ets b/api/@ohos.arkui.stateManagement.static.d.ets similarity index 96% rename from api/@ohos.arkui.stateManagement.d.ets rename to api/@ohos.arkui.stateManagement.static.d.ets index 94b7c1ab1e..4f8e84173b 100644 --- a/api/@ohos.arkui.stateManagement.d.ets +++ b/api/@ohos.arkui.stateManagement.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/api/arkui/component/builder.d.ets b/api/arkui/component/builder.static.d.ets similarity index 95% rename from api/arkui/component/builder.d.ets rename to api/arkui/component/builder.static.d.ets index fcebce52ef..1095b64dd5 100755 --- a/api/arkui/component/builder.d.ets +++ b/api/arkui/component/builder.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/api/arkui/component/customComponent.d.ets b/api/arkui/component/customComponent.static.d.ets similarity index 99% rename from api/arkui/component/customComponent.d.ets rename to api/arkui/component/customComponent.static.d.ets index cfd065cf4b..ea39418c01 100644 --- a/api/arkui/component/customComponent.d.ets +++ b/api/arkui/component/customComponent.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/api/arkui/component/extendableComponent.d.ets b/api/arkui/component/extendableComponent.static.d.ets similarity index 99% rename from api/arkui/component/extendableComponent.d.ets rename to api/arkui/component/extendableComponent.static.d.ets index 7b963c79ef..2dbd7d493d 100644 --- a/api/arkui/component/extendableComponent.d.ets +++ b/api/arkui/component/extendableComponent.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/api/arkui/component/interop.static.d.ets b/api/arkui/component/interop.static.d.ets index f03275f6d8..3bffbf685c 100644 --- a/api/arkui/component/interop.static.d.ets +++ b/api/arkui/component/interop.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/api/arkui/stateManagement/decorator.d.ets b/api/arkui/stateManagement/decorator.static.d.ets similarity index 99% rename from api/arkui/stateManagement/decorator.d.ets rename to api/arkui/stateManagement/decorator.static.d.ets index 43e461b57a..b45e059060 100644 --- a/api/arkui/stateManagement/decorator.d.ets +++ b/api/arkui/stateManagement/decorator.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/api/arkui/stateManagement/remember.static.d.ets b/api/arkui/stateManagement/remember.static.d.ets index c1b2a9df9b..dfc5b4a830 100644 --- a/api/arkui/stateManagement/remember.static.d.ets +++ b/api/arkui/stateManagement/remember.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"), diff --git a/api/arkui/stateManagement/runtime.d.ets b/api/arkui/stateManagement/runtime.static.d.ets similarity index 99% rename from api/arkui/stateManagement/runtime.d.ets rename to api/arkui/stateManagement/runtime.static.d.ets index dac3747116..e19ab206a9 100644 --- a/api/arkui/stateManagement/runtime.d.ets +++ b/api/arkui/stateManagement/runtime.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/api/arkui/stateManagement/storage/appStorage.d.ets b/api/arkui/stateManagement/storage/appStorage.static.d.ets similarity index 98% rename from api/arkui/stateManagement/storage/appStorage.d.ets rename to api/arkui/stateManagement/storage/appStorage.static.d.ets index 4a3bf1b8ff..fd4177082a 100644 --- a/api/arkui/stateManagement/storage/appStorage.d.ets +++ b/api/arkui/stateManagement/storage/appStorage.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/api/arkui/stateManagement/storage/environment.d.ets b/api/arkui/stateManagement/storage/environment.static.d.ets similarity index 99% rename from api/arkui/stateManagement/storage/environment.d.ets rename to api/arkui/stateManagement/storage/environment.static.d.ets index 0a5fef29db..fd11a44bf7 100644 --- a/api/arkui/stateManagement/storage/environment.d.ets +++ b/api/arkui/stateManagement/storage/environment.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"), diff --git a/api/arkui/stateManagement/storage/localStorage.d.ets b/api/arkui/stateManagement/storage/localStorage.static.d.ets similarity index 97% rename from api/arkui/stateManagement/storage/localStorage.d.ets rename to api/arkui/stateManagement/storage/localStorage.static.d.ets index e8fabd0c48..64fd3901b0 100644 --- a/api/arkui/stateManagement/storage/localStorage.d.ets +++ b/api/arkui/stateManagement/storage/localStorage.static.d.ets @@ -1,190 +1,191 @@ -/* - * Copyright (C) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file - * @kit ArkUI - * @arkts 1.2 - */ - -import { AbstractProperty, SubscribedAbstractProperty } from './storageProperty'; - -/** - * LocalStorage - * Class implements a Map of ObservableObjectBase UI state variables. - * Instances can be created to manage UI state within a limited "local" - * access, and life cycle as defined by the app. - * AppStorage singleton is sub-class of LocalStorage for - * UI state of app-wide access and same life cycle as the app. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 20 - */ -export declare class LocalStorage { - /** - * Construct new instance of LocalStorage - * initialize with all properties and their values that Object.keys(params) returns - * Property values must not be undefined. - * - * @param { Record } [initializingProperties] - Record - * containing keys and values. - * see set() for valid values - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 20 - */ - public constructor(initializingProperties?: Record); - /** - * Obtain a handler or an alias to LocalStorage property with given name. - * - * @param { string } propName LocalStorage property name - * @returns { AbstractProperty | undefined } AbstractProperty object if property with given name exists - * return undefined otherwise. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 20 - */ - public ref(propName: string): AbstractProperty | undefined; - /** - * Obtain a handler or an alias to LocalStorage property with given name. - * - * If property does not exist in LocalStorage, create it with given default value. - * - * @param { string } propName LocalStorage property name - * @param { T } defaultValue If property does not exist in LocalStorage, - * create it with given default value.pe - * @returns { AbstractProperty } AbstractProperty object - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 20 - */ - public setAndRef(propName: string, defaultValue: T): AbstractProperty; - /** - * Create and return a two-way sync "(link") to named property - * - * @param { string } propName - name of source property in LocalStorage - * @returns { SubscribedAbstractProperty | undefined } instance of SubscribedAbstractProperty - * return undefined if named property does not already exist in LocalStorage - * Apps can use SDK functions of base class SubscribedPropertyAbstract - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @since 20 - */ - public link(propName: string): SubscribedAbstractProperty | undefined; - - /** - * Like see link(), but will create and initialize a new source property in LocalStorage if missing - * - * @param { string } propName - name of source property in LocalStorage - * @param { T } defaultValue - value to be used for initializing new property in LocalStorage - * default value must be of type T, can be undefined or null. - * @returns { SubscribedAbstractProperty } instance of SubscribedAbstractProperty - * Apps can use SDK functions of base class SubscribedAbstractProperty - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 20 - */ - public setAndLink(propName: string, defaultValue: T): SubscribedAbstractProperty; - - /** - * Check if LocalStorage has a property with given name - * return true if property with given name exists - * same as ES6 Map.prototype.has() - * - * @param { string } propName - searched property - * @returns { boolean } true if property with such name exists in LocalStorage - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 20 - */ - public has(propName: string): boolean; - /** - * Returns value of given property - * return undefined if no property with this name - * - * @param { string } propName - property name - * @returns { T | undefined } property value if found or undefined - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 20 - */ - public get(propName: string): T | undefined; - /** - * Set value of given property in LocalStorage - * Method sets nothing and returns false if property with this name does not exist in LocalStorage - * newValue can be undefined or null from API 20. - * - * @param { string } propName - * @param { T } newValue - must be of type T, can be undefined or null - * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 20 - */ - public set(propName: string, newValue: T): boolean; - /** - * Set value of given property, if it exists, see set() . - * Add property if no property with given name and initialize with given value. - * newValue can be undefined or null from API 12 - * - * @param { string } propName - * @param { T } newValue - must be of type T, can be undefined or null - * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 20 - */ - public setOrCreate(propName: string, newValue: T): boolean; - /** - * Provide names of all properties in LocalStorage - * same as ES6 Map.prototype.keys() - * - * @returns { IterableIterator } return a Map Iterator - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 20 - */ - public keys(): IterableIterator; - /** - * Returns number of properties in LocalStorage - * same as Map.prototype.size() - * - * @returns { number } return number of properties - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 20 - */ - public size(): number; - /** - * Delete property from StorageBase - * Use with caution: - * Before deleting a prop from LocalStorage all its subscribers need to - * unsubscribe from the property. - * This method fails and returns false if given property still has subscribers - * Another reason for failing is unknown property. - * Developer advise: - * Subscribers are created with see link(), see prop() - * and also via @LocalStorageLink and @LocalStorageProp state variable decorators. - * That means as long as their is a @Component instance that uses such decorated variable - * or a sync relationship with a SubscribedAbstractProperty variable the property can nit - * (and also should not!) be deleted from LocalStorage. - * - * @param { string } propName - * @returns { boolean } false if method failed - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 20 - */ - public delete(propName: string): boolean; - /** - * Delete all properties from the LocalStorage instance - * Precondition is that there are no subscribers. - * method returns false and deletes no properties if there is any property - * that still has subscribers - * - * @returns { boolean } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 20 - */ - public clear(): boolean; +'use static' +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ + +import { AbstractProperty, SubscribedAbstractProperty } from './storageProperty'; + +/** + * LocalStorage + * Class implements a Map of ObservableObjectBase UI state variables. + * Instances can be created to manage UI state within a limited "local" + * access, and life cycle as defined by the app. + * AppStorage singleton is sub-class of LocalStorage for + * UI state of app-wide access and same life cycle as the app. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare class LocalStorage { + /** + * Construct new instance of LocalStorage + * initialize with all properties and their values that Object.keys(params) returns + * Property values must not be undefined. + * + * @param { Record } [initializingProperties] - Record + * containing keys and values. + * see set() for valid values + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public constructor(initializingProperties?: Record); + /** + * Obtain a handler or an alias to LocalStorage property with given name. + * + * @param { string } propName LocalStorage property name + * @returns { AbstractProperty | undefined } AbstractProperty object if property with given name exists + * return undefined otherwise. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public ref(propName: string): AbstractProperty | undefined; + /** + * Obtain a handler or an alias to LocalStorage property with given name. + * + * If property does not exist in LocalStorage, create it with given default value. + * + * @param { string } propName LocalStorage property name + * @param { T } defaultValue If property does not exist in LocalStorage, + * create it with given default value.pe + * @returns { AbstractProperty } AbstractProperty object + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public setAndRef(propName: string, defaultValue: T): AbstractProperty; + /** + * Create and return a two-way sync "(link") to named property + * + * @param { string } propName - name of source property in LocalStorage + * @returns { SubscribedAbstractProperty | undefined } instance of SubscribedAbstractProperty + * return undefined if named property does not already exist in LocalStorage + * Apps can use SDK functions of base class SubscribedPropertyAbstract + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 20 + */ + public link(propName: string): SubscribedAbstractProperty | undefined; + + /** + * Like see link(), but will create and initialize a new source property in LocalStorage if missing + * + * @param { string } propName - name of source property in LocalStorage + * @param { T } defaultValue - value to be used for initializing new property in LocalStorage + * default value must be of type T, can be undefined or null. + * @returns { SubscribedAbstractProperty } instance of SubscribedAbstractProperty + * Apps can use SDK functions of base class SubscribedAbstractProperty + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public setAndLink(propName: string, defaultValue: T): SubscribedAbstractProperty; + + /** + * Check if LocalStorage has a property with given name + * return true if property with given name exists + * same as ES6 Map.prototype.has() + * + * @param { string } propName - searched property + * @returns { boolean } true if property with such name exists in LocalStorage + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public has(propName: string): boolean; + /** + * Returns value of given property + * return undefined if no property with this name + * + * @param { string } propName - property name + * @returns { T | undefined } property value if found or undefined + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public get(propName: string): T | undefined; + /** + * Set value of given property in LocalStorage + * Method sets nothing and returns false if property with this name does not exist in LocalStorage + * newValue can be undefined or null from API 20. + * + * @param { string } propName + * @param { T } newValue - must be of type T, can be undefined or null + * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public set(propName: string, newValue: T): boolean; + /** + * Set value of given property, if it exists, see set() . + * Add property if no property with given name and initialize with given value. + * newValue can be undefined or null from API 12 + * + * @param { string } propName + * @param { T } newValue - must be of type T, can be undefined or null + * @returns { boolean } true on success, i.e. when above conditions are satisfied, otherwise false + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public setOrCreate(propName: string, newValue: T): boolean; + /** + * Provide names of all properties in LocalStorage + * same as ES6 Map.prototype.keys() + * + * @returns { IterableIterator } return a Map Iterator + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public keys(): IterableIterator; + /** + * Returns number of properties in LocalStorage + * same as Map.prototype.size() + * + * @returns { number } return number of properties + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public size(): number; + /** + * Delete property from StorageBase + * Use with caution: + * Before deleting a prop from LocalStorage all its subscribers need to + * unsubscribe from the property. + * This method fails and returns false if given property still has subscribers + * Another reason for failing is unknown property. + * Developer advise: + * Subscribers are created with see link(), see prop() + * and also via @LocalStorageLink and @LocalStorageProp state variable decorators. + * That means as long as their is a @Component instance that uses such decorated variable + * or a sync relationship with a SubscribedAbstractProperty variable the property can nit + * (and also should not!) be deleted from LocalStorage. + * + * @param { string } propName + * @returns { boolean } false if method failed + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public delete(propName: string): boolean; + /** + * Delete all properties from the LocalStorage instance + * Precondition is that there are no subscribers. + * method returns false and deletes no properties if there is any property + * that still has subscribers + * + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + public clear(): boolean; } \ No newline at end of file diff --git a/api/arkui/stateManagement/storage/persistentStorage.d.ets b/api/arkui/stateManagement/storage/persistentStorage.static.d.ets similarity index 99% rename from api/arkui/stateManagement/storage/persistentStorage.d.ets rename to api/arkui/stateManagement/storage/persistentStorage.static.d.ets index b9bda0af68..724d5aa379 100644 --- a/api/arkui/stateManagement/storage/persistentStorage.d.ets +++ b/api/arkui/stateManagement/storage/persistentStorage.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"), diff --git a/api/arkui/stateManagement/storage/storageProperty.d.ets b/api/arkui/stateManagement/storage/storageProperty.static.d.ets similarity index 96% rename from api/arkui/stateManagement/storage/storageProperty.d.ets rename to api/arkui/stateManagement/storage/storageProperty.static.d.ets index 56e874225e..b029e3e0c9 100644 --- a/api/arkui/stateManagement/storage/storageProperty.d.ets +++ b/api/arkui/stateManagement/storage/storageProperty.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/api/arkui/stateManagement/utils.d.ets b/api/arkui/stateManagement/utils.static.d.ets similarity index 96% rename from api/arkui/stateManagement/utils.d.ets rename to api/arkui/stateManagement/utils.static.d.ets index a764b6d316..f82570cbab 100644 --- a/api/arkui/stateManagement/utils.d.ets +++ b/api/arkui/stateManagement/utils.static.d.ets @@ -1,3 +1,4 @@ +'use static' /* * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); -- Gitee