[GM > Plugin] Initial Add

This commit is contained in:
Ducko 2021-06-16 08:57:48 +01:00 committed by Alyxia Sother
parent 0d68aa88c2
commit 8b347972ac
No known key found for this signature in database
GPG Key ID: 355968D14144B739
2 changed files with 33 additions and 0 deletions

View File

@ -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();
}
}
}

View File

@ -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",