introduce method to add custom metadata to plugins

master
Drake 2 years ago
parent 7885340c31
commit 55440b2776

@ -51,7 +51,7 @@ async function init() {
});
}
function add(iife: string) {
function add(iife: string, customMeta: UnknownObject = {}) {
const exports = pluginEval(iife);
logger.debug(["Plugins"], `Adding ${exports.meta.name}`);
pluginNest.store.plugins[exports.meta.name] = {
@ -59,6 +59,7 @@ function add(iife: string) {
enabled: false,
desc: exports.meta.desc
};
Object.assign(pluginNest.store.plugins[exports.meta.name], customMeta)
}
function del(name: string) {

5
src/global.d.ts vendored

@ -18,6 +18,11 @@ interface Nest<Schema> {
emit: any
}
//we could just use `{}` for this but that's jank if we want to assign a new key/val to it
type UnknownObject = {
[prop: string]: any
}
type DemonGlobal = {
summon: (mod: string) => any
}

Loading…
Cancel
Save