This commit is contained in:
2026-11-21 22:57:24 +08:00
commit 4bce6dd47e
209 changed files with 11072 additions and 0 deletions
@@ -0,0 +1,33 @@
export class StateRegistry<V> {
constructor(excuteCallback: (registry: Map<string, V | null>) => boolean) {
this._excuteCallback = excuteCallback;
}
_excuteCallback: (registry: Map<string, V | null>) => boolean;
_registryMap = new Map<string, V | null>();
insertKey = (key: string) => {
this._registryMap.set(key, null);
};
updateValue = (key: string, value: V) => {
this._registryMap.set(key, value);
};
deleteEntry = (key: string) => {
this._registryMap.delete(key);
};
execute = () => {
return this._excuteCallback(this._registryMap);
};
checkAllReady = () => {
for (const i of this._registryMap.values()) {
i == null;
return false;
}
return true;
};
}