From 8b347972acbf83db1ca0123b29c939963a74278f Mon Sep 17 00:00:00 2001 From: Oj Date: Wed, 16 Jun 2021 08:57:48 +0100 Subject: [PATCH] [GM > Plugin] Initial Add --- moduleWrappers/goosemod/plugin.js | 32 +++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 33 insertions(+) create mode 100644 moduleWrappers/goosemod/plugin.js diff --git a/moduleWrappers/goosemod/plugin.js b/moduleWrappers/goosemod/plugin.js new file mode 100644 index 0000000..0e316e0 --- /dev/null +++ b/moduleWrappers/goosemod/plugin.js @@ -0,0 +1,32 @@ +import showToast from '@goosemod/toast'; + +export default class Plugin { + constructor() { + this.patches = []; + } + + enqueueUnpatch(unpatch) { + this.patches.push(unpatch); + } + + toast(content, options) { + showToast(content, { + subtext: this.name, + ...options + }); + } + + goosemodHandlers = { + onImport() { + this.onImport(); + }, + + onRemove() { + for (const unpatch of this.patches) { + unpatch(); + } + + this.onRemove(); + } + } +} \ No newline at end of file diff --git a/package.json b/package.json index f54d682..8111212 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "@goosemod/reactUtils": "./moduleWrappers/goosemod/reactUtils.js", "@goosemod/toast": "./moduleWrappers/goosemod/toast.js", "@goosemod/settings": "./moduleWrappers/goosemod/settings.js", + "@goosemod/plugin": "./moduleWrappers/goosemod/plugin.js", "powercord/entities": "./moduleWrappers/powercord/entities.js", "powercord/injector": "./moduleWrappers/powercord/injector.js",