From 068dd4a1f19f72bd19c391bede8b55f7cb5978e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E6=BA=AF?= Date: Tue, 22 Feb 2022 06:47:08 +0000 Subject: [PATCH 1/2] add distributed storage support Signed-off-by: He Su --- .../component/ets/state_management.d.ts | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/api/@internal/component/ets/state_management.d.ts b/api/@internal/component/ets/state_management.d.ts index 0e11d0e5e9..9a8ce9fdb9 100644 --- a/api/@internal/component/ets/state_management.d.ts +++ b/api/@internal/component/ets/state_management.d.ts @@ -599,6 +599,46 @@ declare abstract class SubscribaleAbstract { size(): number; } +/** + * @since 9 + */ + declare class DistributedStorage { + /** + * Constructor parameters. + * @since 9 + */ + constructor(sessionId: string, notifier: (status: string) => void); + + /** + * Called when a property is synced. + * @since 9 + */ + linkProp(key: string, defaultValue: T): void; + + /** + * Called when a property is deleted. + * @since 9 + */ + deleteProp(key: string): void; + + /** + * Called when multiple properties are synced. + * @since 9 + */ + linkProps( + properties: { + key: string; + defaultValue: any; + }[], + ): void; + + /** + * Get the key value. + * @since 9 + */ + Keys(): Array; +} + /** * @since 7 */ -- Gitee From 30dc3670fcc9a909c0d294cb458795959d6824fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E6=BA=AF?= Date: Wed, 2 Mar 2022 04:15:48 +0000 Subject: [PATCH 2/2] add distributed storage support Signed-off-by: He Su --- api/@internal/component/ets/state_management.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/@internal/component/ets/state_management.d.ts b/api/@internal/component/ets/state_management.d.ts index 9a8ce9fdb9..40f0a0b953 100644 --- a/api/@internal/component/ets/state_management.d.ts +++ b/api/@internal/component/ets/state_management.d.ts @@ -613,7 +613,7 @@ declare abstract class SubscribaleAbstract { * Called when a property is synced. * @since 9 */ - linkProp(key: string, defaultValue: T): void; + distributeProp(key: string, defaultValue: T): void; /** * Called when a property is deleted. @@ -625,7 +625,7 @@ declare abstract class SubscribaleAbstract { * Called when multiple properties are synced. * @since 9 */ - linkProps( + distributeProps( properties: { key: string; defaultValue: any; @@ -636,7 +636,7 @@ declare abstract class SubscribaleAbstract { * Get the key value. * @since 9 */ - Keys(): Array; + keys(): Array; } /** -- Gitee