Description
I’ve been working on getting the web sdk working inside a Single Page Application style site. Because the ZoomMtg object creates the #zmmtg-root element when it’s loaded, I made it only load the SDK on the vue-routed page which needs it.
I have it destroying/unloading the ZoomMtg object when the user navigates away, but when they navigate back again, there are some issues with Object.defineProperty things that the zoomus-websdk.umd.min.js
file applies.
These are Array.prototype.uniquelize, Array.prototype.union, and Array.prototype.minus.
The quick fix is to match other is-this-set checks in the same file , e.g. Array.prototype.union || Object.defineProperty(Array.prototype,"union"
…
The better fix would be to mark all of the properties as configurable, and add a ZoomMtg.unload to unset them all, among other things. The even better fix would be to allow deferred activation too, so I can load the sdk with my other javascript!
Browser Console Error
Uncaught TypeError: Cannot redefine property: uniquelize
at Function.defineProperty ()
Which Web Meeting SDK version?
2.0.1
Meeting SDK Code Snippets
node_modules/@zoomus/websdk/dist/zoomus-websdk.umd.min.js, prettified
Array.prototype.intersect || Object.defineProperty(Array.prototype, "intersect", {
enumerable: !1,
value: function() {
for (var e = new Array, t = {}, n = 0; n < arguments.length; n++)
for (var r = 0; r < arguments[n].length; r++) {
var o = arguments[n][r];
t[o] ? (t[o]++,
t[o] === arguments.length && e.push(o)) : t[o] = 1
}
return e
}
}),
Object.defineProperty(Array.prototype, "uniquelize", {
enumerable: !1,
value: function() {
for (var e = {}, t = [], n = 0, r = this.length; n < r; n++)
e[this[n]] || (e[this[n]] = 1,
t.push(this[n]));
return t
}
}),
String.prototype.startsWith || Object.defineProperty(Array.prototype, "startsWith", {
enumerable: !1,
value: function(e, t) {
return t = t || 0,
this.indexOf(e, t) === t
}
}),
Object.defineProperty(Array.prototype, "union", {
enumerable: !1,
value: function() {
for (var e = new Array, t = {}, n = 0; n < arguments.length; n++)
for (var r = 0; r < arguments[n].length; r++) {
var o = arguments[n][r];
t[o] || (t[o] = 1,
e.push(o))
}
return e
}
}),
Object.defineProperty(Array.prototype, "minus", {
enumerable: !1,
value: function(e) {
for (var t = new Array, n = {}, r = 0; r < e.length; r++)
n[e[r]] = 1;
for (var o = 0; o < this.length; o++)
n[this[o]] || (n[this[o]] = 1,
t.push(this[o]));
return t
}
});
To Reproduce(If applicable)
Steps to reproduce the behavior:
- Give the SDK its own public js file. I have webpack mix working on a source file with
import {ZoomMtg} from "@zoomus/websdk";
etc - Load the js file when the component mounts
- Remove the file when the component unmounts, delete #zmmtg-root
- Load the js file a second time when the component mounts again.
Device (please complete the following information):
- Browser: Chrome, but all of them