[Plugins] Basic implementation of plugin settings
This commit is contained in:
parent
62933bc5ba
commit
0fe5d30bbc
4 changed files with 34 additions and 4 deletions
|
@ -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);
|
Loading…
Add table
Add a link
Reference in a new issue