This commit is contained in:
Jiiks 2018-01-11 03:03:32 +02:00
parent 69e10f69cd
commit 32e563effc
3 changed files with 50 additions and 0 deletions

View File

@ -27,6 +27,12 @@ class Module {
if (this.setInitialState) this.setInitialState(this.state);
}
setState(newState) {
const oldState = this.state;
Object.assign(this.state, newState);
if (this.stateChanged) this.stateChanged(oldState, newState);
}
set args(t) { }
get args() { return this.__.args; }
get state() { return this.__.state; }

View File

@ -0,0 +1,17 @@
/**
* BetterDiscord Plugin Base Class
* Copyright (c) 2015-present JsSucks - https://github.com/JsSucks
* All rights reserved.
* https://github.com/JsSucks - https://betterdiscord.net
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
class Plugin {
constructor() {}
}
module.exports = { Plugin }

View File

@ -0,0 +1,27 @@
/**
* BetterDiscord Plugin Manager
* Copyright (c) 2015-present JsSucks - https://github.com/JsSucks
* All rights reserved.
* https://github.com/JsSucks - https://betterdiscord.net
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const { Module } = require('./modulebase');
class PluginManager extends Module {
setInitialState() {
this.setState({
plugins: {}
});
}
get plugins() {
return this.state.plugins;
}
}
module.exports = { PluginManager }