mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2026-03-17 19:23:27 +00:00
feat(data-source): 事件监听添加立即执行配置
This commit is contained in:
parent
67d93ec35f
commit
0d698b20e7
@ -349,8 +349,8 @@ class DataSourceManager extends EventEmitter {
|
|||||||
DataSourceManager.waitInitSchemaList.delete(this);
|
DataSourceManager.waitInitSchemaList.delete(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public onDataChange(id: string, path: string, callback: (newVal: any) => void) {
|
public onDataChange(id: string, path: string, callback: (newVal: any) => void, options?: { immediate?: boolean }) {
|
||||||
return this.get(id)?.onDataChange(path, callback);
|
return this.get(id)?.onDataChange(path, callback, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public offDataChange(id: string, path: string, callback: (newVal: any) => void) {
|
public offDataChange(id: string, path: string, callback: (newVal: any) => void) {
|
||||||
|
|||||||
@ -130,8 +130,8 @@ export default class DataSource<T extends DataSourceSchema = DataSourceSchema> e
|
|||||||
return this.setData(data, path);
|
return this.setData(data, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public onDataChange(path: string, callback: (newVal: any) => void) {
|
public onDataChange(path: string, callback: (newVal: any) => void, options?: { immediate?: boolean }) {
|
||||||
this.#observedData.on(path, callback);
|
this.#observedData.on(path, callback, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public offDataChange(path: string, callback: (newVal: any) => void) {
|
public offDataChange(path: string, callback: (newVal: any) => void) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user