forked from alibaba/lowcode-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditor.ts
More file actions
44 lines (35 loc) · 1.61 KB
/
editor.ts
File metadata and controls
44 lines (35 loc) · 1.61 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
/* eslint-disable max-len */
import { EventEmitter } from 'events';
import StrictEventEmitter from 'strict-event-emitter-types';
import * as GlobalEvent from '../../event';
import { IPublicApiEvent } from '../api';
import { IPublicTypeEditorValueKey, IPublicTypeEditorGetOptions, IPublicTypeEditorGetResult, IPublicTypeEditorRegisterOptions, IPublicTypeAssetsJson } from '../type';
export interface IPublicModelEditor extends StrictEventEmitter<EventEmitter, GlobalEvent.EventConfig> {
get: <T = undefined, KeyOrType = any>(
keyOrType: KeyOrType,
opt?: IPublicTypeEditorGetOptions
) => IPublicTypeEditorGetResult<T, KeyOrType> | undefined;
has: (keyOrType: IPublicTypeEditorValueKey) => boolean;
set: (key: IPublicTypeEditorValueKey, data: any) => void | Promise<void>;
/**
* 获取 keyOrType 一次
*/
onceGot: <T = undefined, KeyOrType extends IPublicTypeEditorValueKey = any>(keyOrType: KeyOrType) => Promise<IPublicTypeEditorGetResult<T, KeyOrType>>;
/**
* 获取 keyOrType 多次
*/
onGot: <T = undefined, KeyOrType extends IPublicTypeEditorValueKey = any>(
keyOrType: KeyOrType,
fn: (data: IPublicTypeEditorGetResult<T, KeyOrType>) => void
) => () => void;
/**
* 监听 keyOrType 变化
*/
onChange: <T = undefined, KeyOrType extends IPublicTypeEditorValueKey = any>(
keyOrType: KeyOrType,
fn: (data: IPublicTypeEditorGetResult<T, KeyOrType>) => void
) => () => void;
register: (data: any, key?: IPublicTypeEditorValueKey, options?: IPublicTypeEditorRegisterOptions) => void;
get eventBus(): IPublicApiEvent;
setAssets(assets: IPublicTypeAssetsJson): void;
}