From b8320bb1670c81d8da5c8e9f20615b6ac0f3a0e6 Mon Sep 17 00:00:00 2001 From: Oj Date: Mon, 5 Jul 2021 15:21:08 +0100 Subject: [PATCH] [GM > Plugin] Add commands wrapper --- moduleWrappers/goosemod/plugin.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/moduleWrappers/goosemod/plugin.js b/moduleWrappers/goosemod/plugin.js index 116adc2..b94f7f5 100644 --- a/moduleWrappers/goosemod/plugin.js +++ b/moduleWrappers/goosemod/plugin.js @@ -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(); }