summaryrefslogtreecommitdiff
path: root/frontend/src/components/DeckyState.tsx
diff options
context:
space:
mode:
authorAAGaming <aa@mail.catvibers.me>2022-08-21 16:41:25 -0400
committerAAGaming <aa@mail.catvibers.me>2022-08-21 16:41:25 -0400
commit8b3f569a09db9daf7748426f916a66591159928f (patch)
tree237cc3711c7098b30a7e7cda97db9e406b0f7db0 /frontend/src/components/DeckyState.tsx
parent1930400032a850b833f5f71523008e326f40547a (diff)
downloaddecky-loader-8b3f569a09db9daf7748426f916a66591159928f.tar.gz
decky-loader-8b3f569a09db9daf7748426f916a66591159928f.zip
Add plugin updater, notification badge, fixesv2.0.5-pre15
Diffstat (limited to 'frontend/src/components/DeckyState.tsx')
-rw-r--r--frontend/src/components/DeckyState.tsx22
1 files changed, 21 insertions, 1 deletions
diff --git a/frontend/src/components/DeckyState.tsx b/frontend/src/components/DeckyState.tsx
index cbeeb5b4..6f13a007 100644
--- a/frontend/src/components/DeckyState.tsx
+++ b/frontend/src/components/DeckyState.tsx
@@ -1,20 +1,30 @@
import { FC, createContext, useContext, useEffect, useState } from 'react';
import { Plugin } from '../plugin';
+import { PluginUpdateMapping } from '../store';
interface PublicDeckyState {
plugins: Plugin[];
activePlugin: Plugin | null;
+ updates: PluginUpdateMapping | null;
+ hasLoaderUpdate?: boolean;
}
export class DeckyState {
private _plugins: Plugin[] = [];
private _activePlugin: Plugin | null = null;
+ private _updates: PluginUpdateMapping | null = null;
+ private _hasLoaderUpdate: boolean = false;
public eventBus = new EventTarget();
publicState(): PublicDeckyState {
- return { plugins: this._plugins, activePlugin: this._activePlugin };
+ return {
+ plugins: this._plugins,
+ activePlugin: this._activePlugin,
+ updates: this._updates,
+ hasLoaderUpdate: this._hasLoaderUpdate,
+ };
}
setPlugins(plugins: Plugin[]) {
@@ -32,6 +42,16 @@ export class DeckyState {
this.notifyUpdate();
}
+ setUpdates(updates: PluginUpdateMapping) {
+ this._updates = updates;
+ this.notifyUpdate();
+ }
+
+ setHasLoaderUpdate(hasUpdate: boolean) {
+ this._hasLoaderUpdate = hasUpdate;
+ this.notifyUpdate();
+ }
+
private notifyUpdate() {
this.eventBus.dispatchEvent(new Event('update'));
}