refactor(plugin): new plugin system poc

This commit is contained in:
Su-Yong
2023-11-09 22:54:58 +09:00
parent b6e7e75ae8
commit afe6accab8
9 changed files with 279 additions and 192 deletions

View File

@ -26,4 +26,9 @@ export interface MenuPlugin<ConfigType extends Config> extends Plugin<ConfigType
onEnable: (config: ConfigType) => void;
}
export const defineConfig = <ConfigType extends Config>(config: ConfigType) => config;
const defaultPluginConfig: Record<string, unknown> = {};
export const definePluginConfig = <T>(id: string, defaultValue: T): T => {
defaultPluginConfig[id] = defaultValue;
return defaultValue;
};