1
0
mirror of synced 2026-04-05 07:48:35 +08:00

feat(data-source): 事件监听添加立即执行配置

This commit is contained in:
roymondchen
2026-03-12 16:37:50 +08:00
parent 67d93ec35f
commit 0d698b20e7
2 changed files with 4 additions and 4 deletions

View File

@@ -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) {