mirror of
https://github.com/NovaGM/ModuleBuilder.git
synced 2024-08-15 00:23:33 +00:00
[GM > Plugin] Add commands wrapper
This commit is contained in:
parent
4b0de84b00
commit
b8320bb167
1 changed files with 9 additions and 0 deletions
|
@ -1,11 +1,19 @@
|
|||
import showToast from '@goosemod/toast';
|
||||
import { commands } from '@goosemod/patcher';
|
||||
|
||||
export default class Plugin {
|
||||
constructor() {
|
||||
this.patches = [];
|
||||
this.commands = [];
|
||||
this.stylesheets = [];
|
||||
}
|
||||
|
||||
command(...args) {
|
||||
this.commands.push(args[0]);
|
||||
|
||||
commands.add(...args);
|
||||
}
|
||||
|
||||
enqueueUnpatch(unpatch) {
|
||||
this.patches.push(unpatch);
|
||||
}
|
||||
|
@ -35,6 +43,7 @@ export default class Plugin {
|
|||
onRemove: () => {
|
||||
this.patches.forEach((x) => x());
|
||||
this.stylesheets.forEach((x) => x.remove());
|
||||
this.commands.forEach((x) => commands.remove(x));
|
||||
|
||||
this.onRemove();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue