diff --git a/api/@internal/component/ets/common.d.ts b/api/@internal/component/ets/common.d.ts index 4ebfb501cb2c4f852fae295b413210dc8e9c4d89..23b05409b79f14a7a147b510e40d8cb51f47013e 100644 --- a/api/@internal/component/ets/common.d.ts +++ b/api/@internal/component/ets/common.d.ts @@ -20,9 +20,10 @@ declare const Component: ClassDecorator; /** * Defining Entry ClassDecorator. - * @since 7 + * Only API 9 and later support parameters. + * @since 9 */ -declare const Entry: ClassDecorator; +declare const Entry: ClassDecorator & ((storage?: LocalStorage) => ClassDecorator); /** * Defining Observed ClassDecorator. @@ -120,6 +121,25 @@ declare const Extend: MethodDecorator & ((value: any) => MethodDecorator); */ declare const CustomDialog: ClassDecorator; +/** + * Defining LocalStorageLink PropertyDecorator. + * @since 9 + */ +declare const LocalStorageLink: (value: string) => PropertyDecorator; + +/** + * Defining LocalStorageProp PropertyDecorator. + * @since 9 + */ +declare const LocalStorageProp: (value: string) => PropertyDecorator; + +/** + * Get context. + * @StageModelOnly + * @since 9 + */ +declare function getContext(component?: Object): Object; + /** * Defines the data type of the interface restriction. * @since 7 diff --git a/api/@internal/component/ets/state_management.d.ts b/api/@internal/component/ets/state_management.d.ts index 310e1ad62b0872b0dfbe070d478c686ef60e4ac0..116989c36d283412ddb701261dae99e1e7d73e3c 100644 --- a/api/@internal/component/ets/state_management.d.ts +++ b/api/@internal/component/ets/state_management.d.ts @@ -585,6 +585,98 @@ declare abstract class SubscribaleAbstract { public removeOwningPropertyById(subscriberId: number): void; } +/** + * Defining LocalStorage. + * @since 9 + */ +declare class LocalStorage { + /** + * constructor. + * @since 9 + */ + constructor(initializingProperties?: Object); + + /** + * Get current LocalStorage shared from stage. + * @StageModelOnly + * @since 9 + */ + static GetShared(): LocalStorage; + + /** + * return true if prooperty with given name exists + * @since 9 + */ + has(propName: string): boolean; + + /** + * return a Map Iterator + * @since 9 + */ + keys(): IterableIterator; + + /** + * return number of properties + * @since 9 + */ + size(): number; + + /** + * returns value of given property + * @since 9 + */ + get(propName: string): T; + + /** + * Set value of given property + * @since 9 + */ + set(propName: string, newValue: T): boolean; + + /** + * add property if not property with given name + * @since 9 + */ + setOrCreate(propName: string, newValue: T): boolean; + + /** + * create and return a 'link' (two-way sync) to named property + * @since 9 + */ + link(propName: string, linkUser?: T, subscribersName?: string): T; + + /** + * Like link(), will create and initialize a new source property in LocalStorge if missing + * @since 9 + */ + setAndLink(propName: string, defaultValue: T, linkUser?: T, subscribersName?: string): T; + + /** + * create and return a 'prop' (one-way sync) to named property + * @since 9 + */ + prop(propName: string, propUser?: T, subscribersName?: string): T; + + /** + * Like prop(), will create and initialize a new source property in LocalStorage if missing + * @since 9 + */ + setAndProp(propName: string, defaultValue: T, propUser?: T, subscribersName?: string): T; + + /** + * Delete property from StorageBase + * @since 9 + * @returns false if method failed + */ + delete(propName: string): boolean; + + /** + * delete all properties from the StorageBase + * @since 9 + */ + clear(): boolean; +} + /** * Used for ide. * @since 7 diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index c73851031bf907ceeac42851e3d4e6929c86c4cb..988080d255af111a9841458da9d2b30e3565bc6b 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -14,7 +14,7 @@ */ import { AsyncCallback, Callback } from './basic' ; import { Context } from './app/context'; -import { ContentStorage } from './@internal/component/ets/stateManagement' +import { LocalStorage } from './@internal/component/ets/stateManagement' /** * Window manager. * @syscap SystemCapability.WindowManager.WindowManager.Core @@ -588,7 +588,7 @@ declare namespace window { * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ - loadContent(path: string, storage: ContentStorage, callback: AsyncCallback): void; + loadContent(path: string, storage: LocalStorage, callback: AsyncCallback): void; /** * Loads content @@ -597,7 +597,7 @@ declare namespace window { * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ - loadContent(path: string, storage: ContentStorage): Promise; + loadContent(path: string, storage: LocalStorage): Promise; /** * Loads content @@ -867,7 +867,7 @@ declare namespace window { * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ - loadContent(path: string, storage: ContentStorage, callback: AsyncCallback): void; + loadContent(path: string, storage: LocalStorage, callback: AsyncCallback): void; /** * Loads content * @param path path of the page to which the content will be loaded @@ -875,7 +875,7 @@ declare namespace window { * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ - loadContent(path: string, storage?: ContentStorage): Promise; + loadContent(path: string, storage?: LocalStorage): Promise; /** * Loads content * @param path path of the page to which the content will be loaded diff --git a/api/application/AbilityContext.d.ts b/api/application/AbilityContext.d.ts index 39bafa4e517a1ea89b518dc2f67c48c4195448b9..23f0676224a95182e166bc77d44d9f3b9ccc4fcf 100755 --- a/api/application/AbilityContext.d.ts +++ b/api/application/AbilityContext.d.ts @@ -24,7 +24,7 @@ import StartOptions from "../@ohos.application.StartOptions"; import PermissionRequestResult from "./PermissionRequestResult"; import { Configuration } from '../@ohos.application.Configuration'; import Caller from '../@ohos.application.Ability'; -import { ContentStorage } from '../@internal/component/ets/state_management'; +import { LocalStorage } from '../@internal/component/ets/stateManagement'; import image from '../@ohos.multimedia.image'; /** @@ -241,9 +241,9 @@ export default class AbilityContext extends Context { * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param contentStorage the storage data used to restore window stage + * @param LocalStorage the storage data used to restore window stage * @StageModelOnly */ - restoreWindowStage(contentStorage: ContentStorage) : void; + restoreWindowStage(localStorage: LocalStorage) : void; } \ No newline at end of file