From bd29fa1dd2eb8e3050a8bd1f492cbdb0978c0618 Mon Sep 17 00:00:00 2001 From: chenbenzhi Date: Mon, 23 Jun 2025 19:31:37 +0800 Subject: [PATCH] add customComponent constructor Signed-off-by: chenbenzhi --- api/arkui/component/customComponent.d.ets | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/api/arkui/component/customComponent.d.ets b/api/arkui/component/customComponent.d.ets index 041ea7179f..3156c0c53a 100755 --- a/api/arkui/component/customComponent.d.ets +++ b/api/arkui/component/customComponent.d.ets @@ -23,6 +23,7 @@ import { ExtendableComponent } from './extendableComponent'; import { GeometryInfo, Layoutable, Measurable, SizeResult } from './common' import { ConstraintSizeOptions } from './units' import { Builder } from './builder' +import { LocalStorage } from './../stateManagement/storage/localStorage'; /** * Defines Entry Annotation. @@ -56,7 +57,7 @@ export @interface Entry { storage: string = ""; /** - * Determines whether to use the LocalStorage instance object returned by the LocalStorage.getShared() interface. + * Determines whether to use the LocalStorage instance object returned by UIContext.getSharedLocalStorage() interface. * * @type { boolean } * @syscap SystemCapability.ArkUI.ArkUI.Full @@ -64,7 +65,7 @@ export @interface Entry { * @atomicservice * @since 20 */ - shared: boolean = false; + useSharedStorage: boolean = false; } /** @@ -168,6 +169,15 @@ export declare abstract class BaseCustomComponent extends ExtendableComponent { * @since 20 */ export declare abstract class CustomComponent, T_Options> extends BaseCustomComponent { + /** + * Constructor to use to create a customComponent instance. + * @param {boolean} [useSharedStorage] - determine whether to use the LocalStorage instance object returned by UIContext.getSharedLocalStorage() interface. + * @param {LocalStorage} [storage] - localStorage instance. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + constructor(useSharedStorage?: boolean, storage?: LocalStorage); + /** * Define the constructor of custom component * -- Gitee