@alilc/lowcode-editor-core
Version:
Core Api for Ali lowCode engine
74 lines (73 loc) • 2.37 kB
TypeScript
import { IPublicTypeEngineOptions, IPublicModelEngineConfig, IPublicModelPreference } from '@alilc/lowcode-types';
export interface IEngineConfig extends IPublicModelEngineConfig {
/**
* if engineOptions.strictPluginMode === true, only accept propertied predefined in EngineOptions.
*
* @param {IPublicTypeEngineOptions} engineOptions
*/
setEngineOptions(engineOptions: IPublicTypeEngineOptions): void;
notifyGot(key: string): void;
setWait(key: string, resolve: (data: any) => void, once?: boolean): void;
delWait(key: string, fn: any): void;
}
export declare class EngineConfig implements IEngineConfig {
private config;
private waits;
/**
* used to store preferences
*
*/
readonly preference: IPublicModelPreference;
constructor(config?: {
[key: string]: any;
});
/**
* 判断指定 key 是否有值
* @param key
*/
has(key: string): boolean;
/**
* 获取指定 key 的值
* @param key
* @param defaultValue
*/
get(key: string, defaultValue?: any): any;
/**
* 设置指定 key 的值
* @param key
* @param value
*/
set(key: string, value: any): void;
/**
* 批量设值,set 的对象版本
* @param config
*/
setConfig(config: {
[key: string]: any;
}): void;
/**
* if engineOptions.strictPluginMode === true, only accept propertied predefined in EngineOptions.
*
* @param {IPublicTypeEngineOptions} engineOptions
*/
setEngineOptions(engineOptions: IPublicTypeEngineOptions): void;
/**
* 获取指定 key 的值,若此时还未赋值,则等待,若已有值,则直接返回值
* 注:此函数返回 Promise 实例,只会执行(fullfill)一次
* @param key
* @returns
*/
onceGot(key: string): Promise<any>;
/**
* 获取指定 key 的值,函数回调模式,若多次被赋值,回调会被多次调用
* @param key
* @param fn
* @returns
*/
onGot(key: string, fn: (data: any) => void): () => void;
notifyGot(key: string): void;
setWait(key: string, resolve: (data: any) => void, once?: boolean): void;
delWait(key: string, fn: any): void;
getPreference(): IPublicModelPreference;
}
export declare const engineConfig: EngineConfig;