Skip to content

Commit 8450879

Browse files
authored
feat(HikVision): add remove plugin function (#797)
* feat(HikVision): add remove plugin function * chore: bump version 10.0.0
1 parent bdbd944 commit 8450879

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/components/BootstrapBlazor.HikVision/BootstrapBlazor.HikVision.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>10.0.0-beta06</Version>
4+
<Version>10.0.0</Version>
55
</PropertyGroup>
66

77
<PropertyGroup>

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)