forked from alibaba/lowcode-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugins.ts
More file actions
63 lines (54 loc) · 1.64 KB
/
plugins.ts
File metadata and controls
63 lines (54 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { IPublicModelPluginInstance, IPublicTypePlugin } from '../model';
import { IPublicTypePreferenceValueType } from '../type';
import { IPublicTypePluginRegisterOptions } from '../type/plugin-register-options';
export interface IPluginPreferenceMananger {
// eslint-disable-next-line max-len
getPreferenceValue: (
key: string,
defaultValue?: IPublicTypePreferenceValueType,
) => IPublicTypePreferenceValueType | undefined;
}
export type PluginOptionsType = string | number | boolean | object;
export interface IPublicApiPlugins {
/**
* 可以通过 plugin api 获取其他插件 export 导出的内容
*/
[key: string]: any;
register(
pluginModel: IPublicTypePlugin,
options?: Record<string, PluginOptionsType>,
registerOptions?: IPublicTypePluginRegisterOptions,
): Promise<void>;
/**
* 引擎初始化时可以提供全局配置给到各插件,通过这个方法可以获得本插件对应的配置
*
* use this to get preference config for this plugin when engine.init() called
*/
getPluginPreference(
pluginName: string,
): Record<string, IPublicTypePreferenceValueType> | null | undefined;
/**
* 获取指定插件
*
* get plugin instance by name
*/
get(pluginName: string): IPublicModelPluginInstance | null;
/**
* 获取所有的插件实例
*
* get all plugin instances
*/
getAll(): IPublicModelPluginInstance[];
/**
* 判断是否有指定插件
*
* check if plugin with certain name exists
*/
has(pluginName: string): boolean;
/**
* 删除指定插件
*
* delete plugin instance by name
*/
delete(pluginName: string): void;
}