@alilc/lowcode-shell
Version:
Shell Layer for AliLowCodeEngine
46 lines (45 loc) • 1.51 kB
TypeScript
import { IEditor, IEventBus } from '@alilc/lowcode-editor-core';
import { IPublicApiEvent, IPublicTypeDisposable } from '@alilc/lowcode-types';
type EventOptions = {
prefix: string;
};
declare const eventBusSymbol: unique symbol;
export declare class Event implements IPublicApiEvent {
workspaceMode: boolean;
private readonly [eventBusSymbol];
private readonly options;
constructor(eventBus: IEventBus, options: EventOptions, workspaceMode?: boolean);
/**
* 监听事件
* @param event 事件名称
* @param listener 事件回调
*/
on(event: string, listener: (...args: any[]) => void): IPublicTypeDisposable;
/**
* 监听事件,会在其他回调函数之前执行
* @param event 事件名称
* @param listener 事件回调
*/
prependListener(event: string, listener: (...args: any[]) => void): IPublicTypeDisposable;
/**
* 取消监听事件
* @param event 事件名称
* @param listener 事件回调
*/
off(event: string, listener: (...args: any[]) => void): void;
/**
* 触发事件
* @param event 事件名称
* @param args 事件参数
* @returns
*/
emit(event: string, ...args: any[]): void;
/**
* DO NOT USE if u fully understand what this method does.
* @param event
* @param args
*/
__internalEmit__(event: string, ...args: unknown[]): void;
}
export declare function getEvent(editor: IEditor, options?: any): Event;
export {};