From 83d07db5b6c827e40c02598f28cfbd46b63c0515 Mon Sep 17 00:00:00 2001 From: wangchensu Date: Wed, 3 Sep 2025 16:16:45 +0800 Subject: [PATCH] add reuse and recycle in builderNode Signed-off-by: wangchensu Change-Id: I86d367443ada88d7b0433694f69d156ab64e93fd --- api/arkui/BuilderNode.static.d.ets | 6 ++- api/arkui/ComponentContent.static.d.ets | 6 ++- .../component/customComponent.static.d.ets | 53 +++++++++++++++++-- 3 files changed, 57 insertions(+), 8 deletions(-) diff --git a/api/arkui/BuilderNode.static.d.ets b/api/arkui/BuilderNode.static.d.ets index b688a38248..4423f64366 100644 --- a/api/arkui/BuilderNode.static.d.ets +++ b/api/arkui/BuilderNode.static.d.ets @@ -25,6 +25,8 @@ import { FrameNode } from './FrameNode'; import { Size } from './Graphics'; import { TouchEvent, MouseEvent, AxisEvent } from './component/common'; import { WrappedBuilder, CustomBuilder, CustomBuilderT } from './component/builder'; +import { RecordData } from '@ohos.base'; + /** * Render type of the node using for indicating that @@ -190,11 +192,11 @@ export declare class BuilderNode { /** * Reuse the BuilderNode based on the provided parameters. * - * @param { Object } [param] - Parameters for reusing BuilderNode. + * @param { RecordData } [param] - Parameters for reusing BuilderNode. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 20 */ - reuse(param?: Object): void; + reuse(param?: RecordData): void; /** * Recycle the BuilderNode. diff --git a/api/arkui/ComponentContent.static.d.ets b/api/arkui/ComponentContent.static.d.ets index 1143847e3c..5ce2b2c837 100644 --- a/api/arkui/ComponentContent.static.d.ets +++ b/api/arkui/ComponentContent.static.d.ets @@ -24,6 +24,8 @@ import { BuildOptions } from './BuilderNode'; import { Content } from './Content'; import { UIContext } from '../@ohos.arkui.UIContext'; import { WrappedBuilder, CustomBuilder, CustomBuilderT } from './component/builder'; +import { RecordData } from '@ohos.base'; + /** * Defines the base class for ComponentContent. * @@ -91,11 +93,11 @@ export declare class ComponentContent extends ComponentContentBas /** * Reuse the ComponentContent based on the provided parameters. * - * @param { Object } [param] - Parameters for reusing ComponentContent. + * @param { RecordData } [param] - Parameters for reusing ComponentContent. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 20 */ - reuse(param?: Object): void; + reuse(param?: RecordData): void; /** * Recycle the ComponentContent. diff --git a/api/arkui/component/customComponent.static.d.ets b/api/arkui/component/customComponent.static.d.ets index 811c354462..f0b9932629 100644 --- a/api/arkui/component/customComponent.static.d.ets +++ b/api/arkui/component/customComponent.static.d.ets @@ -26,6 +26,53 @@ import { ConstraintSizeOptions } from './units' import { Builder } from './builder' import { LocalStorage } from './../stateManagement/storage/localStorage'; import { CustomDialogController } from './customDialogController'; +import { RecordData } from '@ohos.base'; + +/** + * Define ReuseObject for aboutToReuse method. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare class ReuseObject { + /** + * Get the raw data of ReuseObject to get values. + * + * @returns { RecordData } - Returns the raw data of ReuseObject. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + get raw(): RecordData; + + /** + * Get value from the ReuseObject by key. + * + * @param { string } key - the key of target value. + * @returns { RecordData } - the target value. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + $_get(key: string): RecordData; + + /** + * Returns if the key is in the ReuseObject. + * + * @param { string } key - the key of target value. + * @returns { boolean } - if the key is in the ReuseObject. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + has(key: string): boolean; + + /** + * Returns the keys array of the ReuseObject. + * + * @returns { string[] } - the keys array of the ReuseObject. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + keys(): string[]; +} /** * Defines Entry Annotation. @@ -241,13 +288,11 @@ export declare abstract class CustomComponent } params - Custom component init params. + * @param { ReuseObject } params - Custom component init params. * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice * @since 20 */ - aboutToReuse(params: Record): void; + aboutToReuse(params: ReuseObject): void; } /** -- Gitee