|
|
|
@ -22,8 +22,10 @@ async function init(obj: Object): Promise<boolean> {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function addPlugin(iife: string, metadata: Object): Promise<boolean> {
|
|
|
|
|
async function addPlugin(iife: string): Promise<boolean> {
|
|
|
|
|
// expected metadata: {name: "name", desc: "description", author: "author"}
|
|
|
|
|
const exports: Object = (0, eval)(iife);
|
|
|
|
|
const metadata: Object = exports.metadata;
|
|
|
|
|
const obj: Object = {
|
|
|
|
|
// whether the plugin is started or stopped isn't going to be stored in the iDB, so it can be accessed more easily by all components
|
|
|
|
|
metadata: metadata,
|
|
|
|
@ -67,6 +69,9 @@ async function startPlugin(name: string): Promise<boolean> {
|
|
|
|
|
const exports: Object = (0, eval)(plug.iife);
|
|
|
|
|
const onStart: (ctx: Object) => void = exports.onStart;
|
|
|
|
|
let ctx = {}; // ctx is how you're going to store things that need to be accessed in both onStart and onStop. dumb, i know
|
|
|
|
|
if (plug.metadata.cumcord) {
|
|
|
|
|
ctx.cumcord = window.demon //TODO: explicit cumcord compat layer.
|
|
|
|
|
}
|
|
|
|
|
onStart(ctx);
|
|
|
|
|
if (exports.settings)
|
|
|
|
|
settingsInj.registerSettingsEntry(
|
|
|
|
|