ModuleBuilder/moduleWrappers/goosemod/plugin.js

32 lines
488 B
JavaScript
Raw Normal View History

2021-06-16 07:57:48 +00:00
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();
}
}
}