mirror of
https://github.com/chylex/TweetDuck.git
synced 2024-11-23 17:42:46 +01:00
36 lines
669 B
JavaScript
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();
|
|
};
|