export interface LcdpMessageOptions { urlParams: Record | string; } declare type MessageDataType = 'props' | 'style' | 'action' | (string & {}); export interface MessageData { type: MessageDataType; data: Record; key: string; } export interface InitialMessageData { type: 'initial'; data: { openFieldsMap: Record; props: Record; style: Record; events: Record; }; key: string; } declare class LcdpMessage { urlParams: { is: boolean; url: string | null; key?: string; preventDefault?: boolean; }; private watchListeners; private cache; constructor(options: LcdpMessageOptions); private get messageKey(); private get originURL(); private addListener; private emitInitial; private emitWatch; private messageListener; private sendMessageIframe; /** * 触发WebComponent事件调用,用来触发配置的事件执行 * @param id 组件id * @param methodName 组件名称 * @param params 参数,默认为无参数 */ callMethod(id: string, methodName: string, params?: unknown[]): Promise; /** * 监听属性变更 * @param id * @param cb * @param key */ watchProps(id: string, cb: (next: any, prev: any) => void, key?: string | string[]): void; /** * 移除属性监听 * @param id * @param cb */ unwatchProps(id: string, cb: any): void; /** * webComponent初始化完成后回调 * 本方法只会触发一次,监听一次后,不再触发 * @param cb */ initial(cb: (data: InitialMessageData) => void): void; watch(type: MessageDataType, cb: (next: any, prev: any) => void): void; /** * 移除属性监听 * @param id * @param cb */ unwatch(type: MessageDataType, cb: any): void; /** * 销毁 * @returns */ destroyed(): void; } export default LcdpMessage;