import type { CloneableObject } from './Cloneable.js'; import type { I18nResource } from './I18n.js'; import type { LynxContextEventTarget } from './LynxContextEventTarget.js'; import type { PerformancePipelineOptions } from './Performance.js'; export declare const enum IdentifierType { ID_SELECTOR = 0,// css selector /** * @deprecated */ REF_ID = 1, UNIQUE_ID = 2 } export type LynxKernelInject = { init: (opt: { tt: LynxKernelInject; }) => void; buildVersion?: string; }; export interface EventEmitter { addListener(eventName: string, listener: (...args: unknown[]) => void, context?: object): void; removeListener(eventName: string, listener: (...args: unknown[]) => void): void; emit(eventName: string, data: unknown): void; removeAllListeners(eventName?: string): void; trigger(eventName: string, params: string | Record): void; toggle(eventName: string, ...data: unknown[]): void; } export type NativeLynx = { __globalProps: CloneableObject; getJSModule(_moduleName: string): unknown; getNativeApp(): NativeApp; getCoreContext(): LynxContextEventTarget; getCustomSectionSync(key: string): CloneableObject; getCustomSection(key: string): Promise; }; export type NativeTTObject = { lynx: NativeLynx; OnLifecycleEvent: (...args: unknown[]) => void; publicComponentEvent(componentId: string, handlerName: string, eventData?: unknown): void; publishEvent(handlerName: string, data?: unknown): void; GlobalEventEmitter: EventEmitter; lynxCoreInject: any; updateCardData: (newData: Record, options?: Record) => void; onNativeAppReady: () => void; globalThis?: { tt: NativeTTObject; }; updateGlobalProps: (newData: Record) => void; }; export type BundleInitReturnObj = { /** * On the web platform * @param opt * @returns */ init: (opt: { tt: NativeTTObject; }) => unknown; buildVersion?: string; }; /** * const enum will be shakedown in Typescript Compiler */ export declare const enum ErrorCode { SUCCESS = 0, UNKNOWN = 1, NODE_NOT_FOUND = 2, METHOD_NOT_FOUND = 3, PARAM_INVALID = 4, SELECTOR_NOT_SUPPORTED = 5, NO_UI_FOR_NODE = 6 } export interface InvokeCallbackRes { code: ErrorCode; data?: unknown; } export interface NativeApp { id: string; callLepusMethod(name: string, data: unknown, callback: (ret: unknown) => void): void; setTimeout: typeof setTimeout; setInterval: typeof setInterval; clearTimeout: typeof clearTimeout; clearInterval: typeof clearInterval; requestAnimationFrame: (cb: () => void) => void; cancelAnimationFrame: (id: number) => void; readScript: (sourceURL: string, entryName?: string) => string; loadScript: (sourceURL: string, entryName?: string) => BundleInitReturnObj; loadScriptAsync(sourceURL: string, callback: (message: string | null, exports?: BundleInitReturnObj) => void, entryName?: string): void; nativeModuleProxy: Record; setNativeProps: (type: IdentifierType, identifier: string, component_id: string, first_only: boolean, native_props: Record, root_unique_id: number | undefined) => void; invokeUIMethod: (type: IdentifierType, identifier: string, component_id: string, method: string, params: object, callback: (ret: InvokeCallbackRes) => void, root_unique_id: number) => void; getPathInfo: (type: IdentifierType, identifier: string, component_id: string, first_only: boolean, callback: (ret: InvokeCallbackRes) => void, root_unique_id?: number) => void; setCard(tt: NativeTTObject): void; generatePipelineOptions: () => PerformancePipelineOptions; onPipelineStart: (pipeline_id: string) => void; markPipelineTiming: (pipeline_id: string, timing_key: string) => void; bindPipelineIdWithTimingFlag: (pipeline_id: string, timing_flag: string) => void; /** * Support from Lynx 3.0 */ profileStart: (traceName: string, option?: unknown) => void; /** * Support from Lynx 3.0 */ profileEnd: () => void; /*** * Support from Lynx 3.0 */ profileMark: () => void; /** * Support from Lynx 3.0 */ profileFlowId: () => number; /** * Support from Lynx 2.18 */ isProfileRecording: () => boolean; triggerComponentEvent(id: string, params: { eventDetail: CloneableObject; eventOption: CloneableObject; componentId: string; }): void; selectComponent(componentId: string, idSelector: string, single: boolean, callback?: () => void): void; createJSObjectDestructionObserver(callback: (...args: unknown[]) => unknown): {}; setSharedData(dataKey: string, dataVal: T): void; getSharedData(dataKey: string): T | undefined; i18nResource: I18nResource; reportException: (error: Error, _: unknown) => void; __SetSourceMapRelease: (err: Error) => void; __GetSourceMapRelease: (url: string) => string | undefined; queryComponent: (source: string, callback: (ret: { __hasReady: boolean; } | { code: number; detail?: { schema: string; }; }) => void) => void; tt: NativeTTObject | null; }