Fix updater being corrupted by multiple attempts to download

This commit is contained in:
TrainDoctor
2022-08-23 15:23:23 -07:00
parent 8b3f569a09
commit de1c89af21
4 changed files with 22 additions and 6 deletions
+8
View File
@@ -8,6 +8,7 @@ interface PublicDeckyState {
activePlugin: Plugin | null;
updates: PluginUpdateMapping | null;
hasLoaderUpdate?: boolean;
isLoaderUpdating: boolean;
}
export class DeckyState {
@@ -15,6 +16,7 @@ export class DeckyState {
private _activePlugin: Plugin | null = null;
private _updates: PluginUpdateMapping | null = null;
private _hasLoaderUpdate: boolean = false;
private _isLoaderUpdating: boolean = false;
public eventBus = new EventTarget();
@@ -24,6 +26,7 @@ export class DeckyState {
activePlugin: this._activePlugin,
updates: this._updates,
hasLoaderUpdate: this._hasLoaderUpdate,
isLoaderUpdating: this._isLoaderUpdating,
};
}
@@ -52,6 +55,11 @@ export class DeckyState {
this.notifyUpdate();
}
setIsLoaderUpdating(isUpdating: boolean) {
this._isLoaderUpdating = isUpdating;
this.notifyUpdate();
}
private notifyUpdate() {
this.eventBus.dispatchEvent(new Event('update'));
}