1/* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file Defines a modifier which can update attributes to native side. 18 * @kit ArkUI 19 */ 20 21/** 22 * function that returns a default param of AttributeUpdater. 23 * 24 * @typedef { function } Initializer<T> 25 * @returns { T } 26 * @syscap SystemCapability.ArkUI.ArkUI.Full 27 * @crossplatform 28 * @atomicservice 29 * @since 12 30 */ 31declare type Initializer<T> = () => T; 32 33/** 34 * Defines a modifier which can update attributes to native side. 35 * 36 * @implements AttributeModifier 37 * @syscap SystemCapability.ArkUI.ArkUI.Full 38 * @crossplatform 39 * @atomicservice 40 * @since 12 41 */ 42export declare class AttributeUpdater<T, C = Initializer<T>> implements AttributeModifier<T> { 43 44 /** 45 * Defines the normal update attribute function. 46 * 47 * @param { T } instance 48 * @syscap SystemCapability.ArkUI.ArkUI.Full 49 * @crossplatform 50 * @atomicservice 51 * @since 12 52 */ 53 applyNormalAttribute?(instance: T): void; 54 55 /** 56 * Defines a function for initialization. 57 * 58 * @param { T } instance 59 * @syscap SystemCapability.ArkUI.ArkUI.Full 60 * @crossplatform 61 * @atomicservice 62 * @since 12 63 */ 64 initializeModifier(instance: T): void; 65 66 /** 67 * Get attribute of the modifier. 68 * 69 * @returns { T | undefined } The attribute of the modifier. 70 * @syscap SystemCapability.ArkUI.ArkUI.Full 71 * @crossplatform 72 * @atomicservice 73 * @since 12 74 */ 75 get attribute(): T | undefined; 76 77 /** 78 * Used to update constructor params. 79 * 80 * @type { C } 81 * @syscap SystemCapability.ArkUI.ArkUI.Full 82 * @crossplatform 83 * @atomicservice 84 * @since 12 85 */ 86 updateConstructorParams: C; 87 88 /** 89 * Defines a function executed when component changed. 90 * 91 * @param { T } component 92 * @syscap SystemCapability.ArkUI.ArkUI.Full 93 * @crossplatform 94 * @atomicservice 95 * @since 12 96 */ 97 onComponentChanged(component: T): void; 98} 99