1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2024-11-25 05:42:47 +01:00
TweetDuck/resources/Content/plugins/notification/plugins.js

36 lines
669 B
JavaScript

import setup from "../setup.js";
export default function() {
window.PluginBase = class {
constructor() {}
run() {}
};
// noinspection JSUnusedGlobalSymbols
window.TD_PLUGINS = new class {
constructor() {
this.waitingForModules = [];
this.areModulesLoaded = false;
}
install(plugin) {
if (this.areModulesLoaded) {
plugin.obj.run();
}
else {
this.waitingForModules.push(plugin);
}
}
onModulesLoaded(namespace) {
if (namespace === "plugins/notification") {
this.waitingForModules.forEach(plugin => plugin.obj.run());
this.waitingForModules = [];
this.areModulesLoaded = true;
}
}
};
setup();
};