1/* 2 * Copyright (c) 2023 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 16declare class UIContext { 17 instanceId_: number; 18} 19 20declare interface TouchEvent { 21} 22 23declare type UpdateFunc = (elmtId: number, isFirstRender: boolean, param?: Object) => void; 24 25interface UpdateFuncRecord { 26 updateFunc: UpdateFunc; 27 componentName: string; 28 node?: object; 29} 30 31declare function wrapBuilder<Args extends Object[]>( 32 builder: (...args: Args) => void 33): WrappedBuilder<Args>; 34 35declare class WrappedBuilder<Args extends Object[]> { 36 builder: (...args: Args) => void; 37 constructor(builder: (...args: Args) => void); 38} 39 40declare class __JSScopeUtil__ { 41 static syncInstanceId(instanceId: number): void; 42 static restoreInstanceId(): void; 43} 44 45declare interface Size { 46 width: number; 47 height: number; 48} 49 50declare enum XComponentType { 51 SURFACE = 0, 52 COMPONENT, 53 TEXTURE 54} 55 56declare abstract class ViewPU { 57 id__(): number; 58 aboutToUpdate?: (updateParams: Object) => void; 59 updateStateVars(params: {}): void; 60} 61 62/** 63 * WeakRef 64 * ref to an Object that does not prevent the Object from getting GC'ed 65 * current version of tsc does not know about WeakRef 66 * but Ark runtime supports it 67 * 68 */ 69declare class WeakRef<T extends Object> { 70 constructor(o: T); 71 deref(): T; 72} 73 74type RemovedElementInfo = { elmtId: number, tag: string }; 75 76declare class UINodeRegisterProxy { 77 public static instance_: UINodeRegisterProxy; 78 public removeElementsInfo_: Array<RemovedElementInfo>; 79 public static ElementIdToOwningViewPU_: Map<number, WeakRef<JSBuilderNode>>; 80 public unregisterElmtIdsFromViewPUs(): void; 81 private obtainDeletedElmtIds(): void; 82 public static unregisterElmtIdsFromViewPUs(): void; 83 public static obtainDeletedElmtIds(): void; 84} 85 86declare interface RegisterParams { 87 name: string; 88 idOfNode: Symbol 89} 90 91declare class FinalizationRegistry { 92 constructor(fun: (arg0: RegisterParams) => void); 93 register(target: BuilderNode, heldValue: RegisterParams): undefined; 94} 95