Skip to content

Commit ea981f5

Browse files
committed
feat(HikVision): add remove plugin function
1 parent bdbd944 commit ea981f5

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

  • src/components/BootstrapBlazor.HikVision/wwwroot

src/components/BootstrapBlazor.HikVision/wwwroot/hikvision.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,21 @@ const hackJSDestroyPlugin = function () {
4444
return origianlSendRequestProxy.call(this, r);
4545
}
4646
}
47-
return this.oPlugin.JS_DestroyPlugin(true);
47+
this.oPlugin.JS_DestroyPlugin(true);
48+
49+
JSVideoPlugin = null;
50+
delete window.JSVideoPlugin;
51+
removePlugin();
52+
}
53+
}
54+
55+
const removePlugin = () => {
56+
const scripts = [...document.head.querySelectorAll('script')]
57+
const nodes = scripts.filter(function (link) {
58+
return link.src.indexOf('/jsVideoPlugin-1.0.0.min.js') > -1
59+
})
60+
for (let index = 0; index < nodes.length; index++) {
61+
document.head.removeChild(nodes[index])
4862
}
4963
}
5064

0 commit comments

Comments
 (0)