Merge pull request #1518 from jitsi/fix_removeListeners
fix(external_api): JS error in removeListeners and simplifies dispose
This commit is contained in:
commit
607bef8d68
|
@ -319,16 +319,14 @@ class JitsiMeetExternalAPI extends EventEmitter {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
dispose() {
|
dispose() {
|
||||||
const frame = document.getElementById(this.frameName);
|
if (this.postis) {
|
||||||
|
this.postis.destroy();
|
||||||
this.postis.destroy();
|
this.postis = null;
|
||||||
if (frame) {
|
|
||||||
frame.src = 'about:blank';
|
|
||||||
}
|
}
|
||||||
window.setTimeout(() => {
|
this.removeAllListeners();
|
||||||
this.iframeHolder.removeChild(this.frame);
|
if (this.iframeHolder) {
|
||||||
this.iframeHolder.parentNode.removeChild(this.iframeHolder);
|
this.iframeHolder.parentNode.removeChild(this.iframeHolder);
|
||||||
}, 10);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -350,6 +348,13 @@ class JitsiMeetExternalAPI extends EventEmitter {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.postis) {
|
||||||
|
logger.error('Cannot execute command using disposed instance.');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.postis.send({
|
this.postis.send({
|
||||||
method: commands[name],
|
method: commands[name],
|
||||||
params: args
|
params: args
|
||||||
|
@ -398,7 +403,7 @@ class JitsiMeetExternalAPI extends EventEmitter {
|
||||||
* NOTE: This method is not removed for backward comatability purposes.
|
* NOTE: This method is not removed for backward comatability purposes.
|
||||||
*/
|
*/
|
||||||
removeEventListener(event) {
|
removeEventListener(event) {
|
||||||
this.removeListeners(event);
|
this.removeAllListeners(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue