automatically unpatch all on plugin unload

pull/82/head
dperolio 3 years ago
parent 6b0e152e28
commit de3996b601

@ -1,7 +1,7 @@
import { log, warn, error, MODULES } from '@vizality/util/logger';
import { toPlural, toTitleCase } from '@vizality/util/string';
import { resolveCompiler } from '@vizality/compilers';
import { unpatchAllByAddon } from '@vizality/patcher';
import { unpatchAll } from '@vizality/patcher';
import { jsonToReact } from '@vizality/util/react';
import { createElement } from '@vizality/util/dom';
import { Directories } from '@vizality/constants';
@ -492,7 +492,7 @@ export default class Plugin extends Updatable {
vizality.api.settings.unregisterSettings(this.addonId, 'plugin');
}
//unpatchAllByAddon(this.addonId);
unpatchAll(this.addonId);
}
if (showLogs) {

@ -124,7 +124,6 @@ export function patch (...args) {
export function getPatchesByCaller (caller = getCaller()?.id) {
console.log('caller', caller);
const found = [];
for (const patch of patches) {
for (const child of patch.childs) {
@ -138,7 +137,6 @@ export function getPatchesByCaller (caller = getCaller()?.id) {
export function unpatchAll (caller) {
const patches = getPatchesByCaller(caller);
console.log('patches', patches);
for (const patch of patches) {
patch.unpatch();
}

Loading…
Cancel
Save