mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2026-03-12 10:54:59 +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);
|
||||
}
|
||||
|
||||
public onDataChange(id: string, path: string, callback: (newVal: any) => void) {
|
||||
return this.get(id)?.onDataChange(path, callback);
|
||||
public onDataChange(id: string, path: string, callback: (newVal: any) => void, options?: { immediate?: boolean }) {
|
||||
return this.get(id)?.onDataChange(path, callback, options);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public onDataChange(path: string, callback: (newVal: any) => void) {
|
||||
this.#observedData.on(path, callback);
|
||||
public onDataChange(path: string, callback: (newVal: any) => void, options?: { immediate?: boolean }) {
|
||||
this.#observedData.on(path, callback, options);
|
||||
}
|
||||
|
||||
public offDataChange(path: string, callback: (newVal: any) => void) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user