161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit ArkUI 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ci/** 2261847f8eSopenharmony_ci * Used to do observer layout and draw event for component. 2361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 2461847f8eSopenharmony_ci * @crossplatform 2561847f8eSopenharmony_ci * @since 10 2661847f8eSopenharmony_ci */ 2761847f8eSopenharmony_ci/** 2861847f8eSopenharmony_ci * Used to do observer layout and draw event for component. 2961847f8eSopenharmony_ci * 3061847f8eSopenharmony_ci * @namespace inspector 3161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 3261847f8eSopenharmony_ci * @crossplatform 3361847f8eSopenharmony_ci * @atomicservice 3461847f8eSopenharmony_ci * @since 12 3561847f8eSopenharmony_ci */ 3661847f8eSopenharmony_cideclare namespace inspector { 3761847f8eSopenharmony_ci 3861847f8eSopenharmony_ci /** 3961847f8eSopenharmony_ci * The ComponentObserver is used to listen for layout and draw events. 4061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 4161847f8eSopenharmony_ci * @crossplatform 4261847f8eSopenharmony_ci * @since 10 4361847f8eSopenharmony_ci */ 4461847f8eSopenharmony_ci /** 4561847f8eSopenharmony_ci * The ComponentObserver is used to listen for layout and draw events. 4661847f8eSopenharmony_ci * 4761847f8eSopenharmony_ci * @interface ComponentObserver 4861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 4961847f8eSopenharmony_ci * @crossplatform 5061847f8eSopenharmony_ci * @atomicservice 5161847f8eSopenharmony_ci * @since 12 5261847f8eSopenharmony_ci */ 5361847f8eSopenharmony_ci interface ComponentObserver { 5461847f8eSopenharmony_ci 5561847f8eSopenharmony_ci /** 5661847f8eSopenharmony_ci * Registers a callback with the corresponding query condition by using the handle. 5761847f8eSopenharmony_ci * This callback is triggered when the component layout complete. 5861847f8eSopenharmony_ci * @param { string } type - type of the listened event. 5961847f8eSopenharmony_ci * @param { ()=>void } callback - callback of the listened event. 6061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 6161847f8eSopenharmony_ci * @crossplatform 6261847f8eSopenharmony_ci * @since 10 6361847f8eSopenharmony_ci */ 6461847f8eSopenharmony_ci /** 6561847f8eSopenharmony_ci * Registers a callback with the corresponding query condition by using the handle. 6661847f8eSopenharmony_ci * This callback is triggered when the component layout complete. 6761847f8eSopenharmony_ci * @param { 'layout' } type - type of the listened event. 6861847f8eSopenharmony_ci * @param { function } callback - callback of the listened event. 6961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 7061847f8eSopenharmony_ci * @crossplatform 7161847f8eSopenharmony_ci * @atomicservice 7261847f8eSopenharmony_ci * @since 12 7361847f8eSopenharmony_ci */ 7461847f8eSopenharmony_ci on(type: 'layout', callback: () => void): void; 7561847f8eSopenharmony_ci 7661847f8eSopenharmony_ci /** 7761847f8eSopenharmony_ci * Deregisters a callback with the corresponding query condition by using the handle. 7861847f8eSopenharmony_ci * This callback is not triggered when the component layout complete. 7961847f8eSopenharmony_ci * @param { string } type - type of the listened event. 8061847f8eSopenharmony_ci * @param { ()=>void } callback - callback of the listened event. 8161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 8261847f8eSopenharmony_ci * @crossplatform 8361847f8eSopenharmony_ci * @since 10 8461847f8eSopenharmony_ci */ 8561847f8eSopenharmony_ci /** 8661847f8eSopenharmony_ci * Deregisters a callback with the corresponding query condition by using the handle. 8761847f8eSopenharmony_ci * This callback is not triggered when the component layout complete. 8861847f8eSopenharmony_ci * @param { 'layout' } type - type of the listened event. 8961847f8eSopenharmony_ci * @param { function } callback - callback of the listened event. 9061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 9161847f8eSopenharmony_ci * @crossplatform 9261847f8eSopenharmony_ci * @atomicservice 9361847f8eSopenharmony_ci * @since 12 9461847f8eSopenharmony_ci */ 9561847f8eSopenharmony_ci off(type: 'layout', callback?: () => void): void; 9661847f8eSopenharmony_ci 9761847f8eSopenharmony_ci /** 9861847f8eSopenharmony_ci * Registers a callback with the corresponding query condition by using the handle. 9961847f8eSopenharmony_ci * This callback is triggered when the component draw complete. 10061847f8eSopenharmony_ci * @param { string } type - type of the listened event. 10161847f8eSopenharmony_ci * @param { ()=>void } callback - callback of the listened event. 10261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 10361847f8eSopenharmony_ci * @crossplatform 10461847f8eSopenharmony_ci * @since 10 10561847f8eSopenharmony_ci */ 10661847f8eSopenharmony_ci /** 10761847f8eSopenharmony_ci * Registers a callback with the corresponding query condition by using the handle. 10861847f8eSopenharmony_ci * This callback is triggered when the component draw complete. 10961847f8eSopenharmony_ci * @param { 'draw' } type - type of the listened event. 11061847f8eSopenharmony_ci * @param { function } callback - callback of the listened event. 11161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 11261847f8eSopenharmony_ci * @crossplatform 11361847f8eSopenharmony_ci * @atomicservice 11461847f8eSopenharmony_ci * @since 12 11561847f8eSopenharmony_ci */ 11661847f8eSopenharmony_ci on(type: 'draw', callback: () => void): void; 11761847f8eSopenharmony_ci 11861847f8eSopenharmony_ci /** 11961847f8eSopenharmony_ci * Deregisters a callback with the corresponding query condition by using the handle. 12061847f8eSopenharmony_ci * This callback is not triggered when the component draw complete. 12161847f8eSopenharmony_ci * @param { string } type - type of the listened event. 12261847f8eSopenharmony_ci * @param { ()=>void } callback - callback of the listened event. 12361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 12461847f8eSopenharmony_ci * @crossplatform 12561847f8eSopenharmony_ci * @since 10 12661847f8eSopenharmony_ci */ 12761847f8eSopenharmony_ci /** 12861847f8eSopenharmony_ci * Deregisters a callback with the corresponding query condition by using the handle. 12961847f8eSopenharmony_ci * This callback is not triggered when the component draw complete. 13061847f8eSopenharmony_ci * @param { 'draw' } type - type of the listened event. 13161847f8eSopenharmony_ci * @param { function } callback - callback of the listened event. 13261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 13361847f8eSopenharmony_ci * @crossplatform 13461847f8eSopenharmony_ci * @atomicservice 13561847f8eSopenharmony_ci * @since 12 13661847f8eSopenharmony_ci */ 13761847f8eSopenharmony_ci off(type: 'draw', callback?: () => void): void; 13861847f8eSopenharmony_ci } 13961847f8eSopenharmony_ci 14061847f8eSopenharmony_ci /** 14161847f8eSopenharmony_ci * Sets the component after layout or draw criteria and returns the corresponding listening handle 14261847f8eSopenharmony_ci * @param { string } id - component id. 14361847f8eSopenharmony_ci * @returns { ComponentObserver } create listener for observer component event. 14461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 14561847f8eSopenharmony_ci * @crossplatform 14661847f8eSopenharmony_ci * @since 10 14761847f8eSopenharmony_ci */ 14861847f8eSopenharmony_ci /** 14961847f8eSopenharmony_ci * Sets the component after layout or draw criteria and returns the corresponding listening handle 15061847f8eSopenharmony_ci * @param { string } id - component id. 15161847f8eSopenharmony_ci * @returns { ComponentObserver } create listener for observer component event. 15261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 15361847f8eSopenharmony_ci * @crossplatform 15461847f8eSopenharmony_ci * @atomicservice 15561847f8eSopenharmony_ci * @since 12 15661847f8eSopenharmony_ci */ 15761847f8eSopenharmony_ci function createComponentObserver(id: string): ComponentObserver; 15861847f8eSopenharmony_ci} 15961847f8eSopenharmony_ci 16061847f8eSopenharmony_ciexport default inspector; 161