[Plugins] Basic implementation of plugin settings

This commit is contained in:
Beef 2023-01-05 23:07:58 +00:00
parent 62933bc5ba
commit 0fe5d30bbc
4 changed files with 34 additions and 4 deletions

View file

@ -4,6 +4,7 @@ import logger from "./logger";
type EvaledPlugin = {
onLoad?(): void;
onUnload(): void;
settings: JSX.Element;
};
export const plugins: Indexable<Plugin> = {};
@ -92,5 +93,7 @@ export function stopPlugin(id: string) {
plugin.enabled = false;
}
export const getSettings = (id: string) => loadedPlugins[id]?.settings;
// TODO: When startAllPlugins exists, return this so cleanup in index.ts is easier
const stopAllPlugins = () => Object.keys(loadedPlugins).forEach(stopPlugin);