|
|
@@ -203,6 +203,9 @@ export function setupInjectedStyle(
|
|
|
|
|
|
const injectedUIEffects = new Map<string, () => void>()
|
|
|
|
|
|
+// @ts-ignore
|
|
|
+window.__injectedUIEffects = injectedUIEffects
|
|
|
+
|
|
|
export function setupInjectedUI(
|
|
|
this: PluginLocal,
|
|
|
ui: UIOptions,
|
|
|
@@ -380,6 +383,16 @@ export function setupInjectedUI(
|
|
|
return teardownUI
|
|
|
}
|
|
|
|
|
|
+export function cleanInjectedUI(
|
|
|
+ id: string
|
|
|
+) {
|
|
|
+ if (!injectedUIEffects.has(id)) return
|
|
|
+ const clean = injectedUIEffects.get(id)
|
|
|
+ try { clean() } catch (e) {
|
|
|
+ console.warn('[CLEAN Injected UI] ', id, e)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
export function cleanInjectedScripts(this: PluginLocal) {
|
|
|
const scripts = document.head.querySelectorAll(`script[data-ref=${this.id}]`)
|
|
|
|