import UserConfig from '../../config'; import { EventCenterMapItem, EventCenterUserSelect } from '../eventCenter'; import { FunctionConfigType } from './config'; /** * * ctx可在事件链中传递,函数完成后调用next执行下一个函数 * @export */ export declare type FunctionCenterFunction = (ctx: Record, next: Function, config: UserConfig, args: Record, eventList: { arr: Array; displayName: string; userSelect: Array; }, iname: EventCenterMapItem) => void; export declare type FunctionCenterType = Record; /** * * 初始化时可以加载初始已配好的函数 * @export * @class FunctionCenter */ export declare class FunctionCenter { initConfig: FunctionCenterType; /** * * 该map 用于获取函数未获取到时,异步拉取 * @memberof FunctionCenter */ private asyncMap; configMap: Record; funcitonMap: Record; constructor(initConfig?: FunctionCenterType); init(initConfig: FunctionCenterType): void; reset(): void; getFunctionMap(): Record; getConfigMap(): Record; /** * * 注册函数,同名覆盖,返回删除函数 * @param {string} name * @param {FunctionCenterFunction} fn * @return {*} * @memberof FunctionCenter */ register(name: string, fn: FunctionCenterFunction, config: FunctionConfigType): () => void; /** * * 获取函数,包含异步获取函数 * @param {string} name * @return {*} {Promise} * @memberof FunctionCenter */ getFunction(name: string): Promise; }