feat(data-source): 新增判断所有数据源加载完成的方法

This commit is contained in:
roymondchen 2025-05-21 16:27:49 +08:00
parent a35789c0cf
commit dc37d4e8bd

View File

@ -203,7 +203,7 @@ class DataSourceManager extends EventEmitter {
this.setData(ds, changeEvent); this.setData(ds, changeEvent);
}); });
if (!this.app.dsl?.dataSources || this.dataSourceMap.size === this.app.dsl.dataSources.length) { if (this.isAllDataSourceRegistered()) {
this.emit('registered-all'); this.emit('registered-all');
} }
@ -328,6 +328,10 @@ class DataSourceManager extends EventEmitter {
); );
} }
public isAllDataSourceRegistered() {
return !this.app.dsl?.dataSources?.length || this.dataSourceMap.size === this.app.dsl.dataSources.length;
}
public destroy() { public destroy() {
this.removeAllListeners(); this.removeAllListeners();
this.data = {}; this.data = {};