From 67d8d15eb586ce317f3c7d50215bb995ab7137fd Mon Sep 17 00:00:00 2001 From: hwx1119949 Date: Mon, 4 Aug 2025 13:50:01 +0800 Subject: [PATCH] remove storage Signed-off-by: hwx1119949 --- api/arkui/stateManagement/storage.d.ets | 339 ------------------------ 1 file changed, 339 deletions(-) delete mode 100644 api/arkui/stateManagement/storage.d.ets diff --git a/api/arkui/stateManagement/storage.d.ets b/api/arkui/stateManagement/storage.d.ets deleted file mode 100644 index d9db07a645..0000000000 --- a/api/arkui/stateManagement/storage.d.ets +++ /dev/null @@ -1,339 +0,0 @@ -/* - * 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 - */ - -export interface StorageProperty { - key: string; - defaultValue: number | string | boolean | Object; -} - -export type PersistPropsOptions = StorageProperty; - -interface AbstractProperty { - info(): string; - get(): T; - set(newValue: T): void; -} - -interface SubscribedAbstractProperty extends AbstractProperty { - aboutToBeDeleted(): void; -} - -declare class LocalStorage { - static getShared(): LocalStorage | undefined; - - constructor(initializingProperties?: StorageProperty[]); - - has(propName: string): boolean; - - keys(): IterableIterator; - - size(): int; - - get(propName: string): T | undefined; - - set(propName: string, newValue: T): boolean; - - setOrCreate(propName: string, newValue?: T): boolean; - - ref(propName: string): AbstractProperty | undefined; - - setAndRef(propName: string, defaultValue: T): AbstractProperty; - - link(propName: string): SubscribedAbstractProperty | undefined; - - setAndLink(propName: string, defaultValue: T): SubscribedAbstractProperty; - - prop(propName: string): SubscribedAbstractProperty | undefined; - - setAndProp(propName: string, defaultValue: T): SubscribedAbstractProperty; - - delete(propName: string): boolean; - - clear(): boolean; -} - -declare class AppStorage { - static has(propName: string): boolean; - - static keys(): IterableIterator; - - static size(): int; - - static get(propName: string): T | undefined; - - static set(propName: string, newValue: T): boolean; - - static setOrCreate(propName: string, newValue?: T): boolean; - - static ref(propName: string): AbstractProperty | undefined; - - static setAndRef(propName: string, defaultValue: T): AbstractProperty; - - static link(propName: string): SubscribedAbstractProperty | undefined; - - static setAndLink(propName: string, defaultValue: T): SubscribedAbstractProperty; - - static prop(propName: string): SubscribedAbstractProperty | undefined; - - static setAndProp(propName: string, defaultValue: T): SubscribedAbstractProperty; - - static delete(propName: string): boolean; - - static clear(): boolean; -} - -export declare class PersistentStorage { - - static persistProp(key: string, defaultValue: T): void; - - static deleteProp(key: string): void; - - static persistProps(props: PersistPropsOptions[]): void; - - static keys(): Array; -} - -export interface EnvPropsOptions { - key: string; - defaultValue: number | string | boolean; -} - -export declare class Environment { - static envProp(key: string, value: S): boolean; - - static envProps(props: EnvPropsOptions[]): void; - - static keys(): Array; -} - - -/** - * Function that returns default creator. - * - * @typedef { function } StorageDefaultCreator - * @returns { T } default creator - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -export type StorageDefaultCreator = () => T; - -/** - * Define class constructor with arbitrary parameters. - * @interface TypeConstructorWithArgs - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -// #ToDO: fix -export interface TypeConstructorWithArgs { - /** - * @param { any } args the arguments of the constructor. - * @returns { T } return class instance. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ - // new(...args: Array): T; -} - -/** - * AppStorageV2 is for UI state of app-wide access, has same life cycle as the app, - * and saves database content only in memory. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -export declare class AppStorageV2 { - /** - * If the value for the given key is already available, return the value. - * If not, add the key with value generated by calling defaultFunc and return it to caller. - * - * @param { TypeConstructorWithArgs } type class type of the stored value. - * @param { string | StorageDefaultCreator } [keyOrDefaultCreator] alias name of the key, - * or the function generating the default value. - * @param { StorageDefaultCreator } [defaultCreator] the function generating the default value - * @returns { T | undefined } the value of the existed key or the default value - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ - static connect( - type: TypeConstructorWithArgs, - keyOrDefaultCreator?: string | StorageDefaultCreator, - defaultCreator?: StorageDefaultCreator - ): T | undefined; - - /** - * Removes data with the given key or given class type. - * - * @param { string | TypeConstructorWithArgs } keyOrType key or class type removing - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ - static remove(keyOrType: string | TypeConstructorWithArgs): void; - /** - * Return the array of all keys. - * - * @returns { Array } the array of all keys - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ - static keys(): Array; -} - -/** - * Function that returns reason type when error. - * - * @typedef { function } PersistenceErrorCallback - * @param { string } key persisted key when error - * @param { 'quota' | 'serialization' | 'unknown' } reason reason type when error - * @param { string } message more message when error - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -export type PersistenceErrorCallback = (key: string, reason: 'quota' | 'serialization' | 'unknown', message: string) => void; - -/** - * PersistenceV2 is for UI state of app-wide access, available on app re-start, - * and saves database content in disk. - * - * @extends AppStorageV2 - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -export declare class PersistenceV2 extends AppStorageV2 { - /** - * Used to manually persist data changes to disks. - * - * @param { string | TypeConstructorWithArgs } keyOrType key or class type need to persist. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ - static save(keyOrType: string | TypeConstructorWithArgs): void; - - /** - * Be called when persisting has encountered an error. - * - * @param { PersistenceErrorCallback | undefined } callback called when error - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ - static notifyOnError(callback: PersistenceErrorCallback | undefined): void; -} - -/** - * Define TypeConstructor type. - * - * @interface TypeConstructor - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -export interface TypeConstructor { - /** - * @returns { T } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ - // new(): T; -} - -/** - * Function that returns PropertyDecorator. - * - * @typedef { function } TypeDecorator - * @param { TypeConstructor } type type info - * @returns { PropertyDecorator } Type decorator - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -// export type TypeDecorator = (type: TypeConstructor) => PropertyDecorator; - - -/** - * Define Type PropertyDecorator, adds type information to an object. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -// export declare const Type: TypeDecorator; - -/** - * UIUtils is a state management tool class for operating the observed data. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ -export declare class UIUtils { - /** - * Get raw object from the Object wrapped with an ObservedObject. - * If input parameter is a regular Object without ObservedObject, return Object itself. - * - * @param { T } source input source Object data. - * @returns { T } raw object from the Object wrapped with an ObservedObject. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ - static getTarget(source: T): T; - - /** - * Make non-observed data into observed data. - * Support non-observed class, JSON.parse Object and Sendable class. - * - * @param { T } source input source object data. - * @returns { T } proxy object from the source object data. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 12 - */ - static makeObserved(source: T): T; - -} \ No newline at end of file -- Gitee