From 9f3eadfd86311fa6f7b49bfbf1d92a6a892be266 Mon Sep 17 00:00:00 2001 From: tusi_fly Date: Tue, 18 Jan 2022 10:52:59 +0800 Subject: [PATCH] contentStorage Signed-off-by: tusi_fly Change-Id: I472b8b618021b80ecab168597bba280aebdecf0c --- api/@internal/component/ets/common.d.ts | 14 ++++ .../component/ets/stateManagement.d.ts | 83 +++++++++++++++++++ 2 files changed, 97 insertions(+) diff --git a/api/@internal/component/ets/common.d.ts b/api/@internal/component/ets/common.d.ts index 788077c39f..ca5a28f447 100644 --- a/api/@internal/component/ets/common.d.ts +++ b/api/@internal/component/ets/common.d.ts @@ -180,6 +180,20 @@ declare function $r(value: string, ...params: any[]): Resource; */ declare function $rawfile(value: string): Resource; +/** + * global getContentStorage function + * @since 8 + */ +declare function getContentStorage(value: any): ContentStorage; + +declare type Context = any; + +/** + * global getContext function + * @since 8 + */ +declare function getContext(value: any): Context; + interface AnimateToParam { duration?: number; tempo?: number; diff --git a/api/@internal/component/ets/stateManagement.d.ts b/api/@internal/component/ets/stateManagement.d.ts index ca532e1754..0fea7d5697 100644 --- a/api/@internal/component/ets/stateManagement.d.ts +++ b/api/@internal/component/ets/stateManagement.d.ts @@ -502,6 +502,89 @@ declare abstract class SubscribaleAbstract { public removeOwningPropertyById(subscriberId: number): void; } +/** + * @since 8 + */ + declare class ContentStorage { + /** + * Called when a link is set. + * @since 8 + */ + link(propName: string): any; + + /** + * Called when a hyperlink is set. + * @since 8 + */ + setAndLink(propName: string, defaultValue: T): SubscribedAbstractProperty; + + /** + * Called when a property is set. + * @since 8 + */ + prop(propName: string): any; + + /** + * Called when dynamic properties are set. + * @since 8 + */ + setAndProp(propName: string, defaultValue: S): SubscribedAbstractProperty; + + /** + * Called when owning or not. + * @since 8 + */ + has(propName: string): boolean; + + /** + * Called when data is obtained. + * @since 8 + */ + get(propName: string): T | undefined; + + /** + * Called when setting. + * @since 8 + */ + set(propName: string, newValue: T): boolean; + + /** + * Called when setting or creating. + * @since 8 + */ + setOrCreate(propName: string, newValue: T): void; + + /** + * Called when a deletion is made. + * @since 8 + */ + delete(propName: string): boolean; + + /** + * Called when a dictionary is sorted. + * @since 8 + */ + keys(): IterableIterator; + + /** + * Called when a cleanup occurs. + * @since 8 + */ + clear(): boolean; + + /** + * Called when the data can be changed. + * @since 8 + */ + isMutable(propName: string): boolean; + + /** + * Called when you check how much data is stored. + * @since 8 + */ + size(): number; +} + /** * @since 7 */ -- Gitee