Skip to content

Commit

Permalink
fix: Clears resources when api will be disposed.
Browse files Browse the repository at this point in the history
  • Loading branch information
damencho committed Jan 17, 2025
1 parent f99e45d commit 6724c78
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions alwaysontop/render/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ class AlwaysOnTop extends EventEmitter {

this._api.on('videoConferenceJoined', this._onConferenceJoined);
this._api.on('readyToClose', this._disposeWindow);
this._api.on('_willDispose', this._disposeWindow);

if (showOnPrejoin) {
this._api.on('prejoinScreenLoaded', this._onConferenceJoined);
}

window.parent.addEventListener('beforeunload', this._disposeWindow);
}

Expand Down Expand Up @@ -136,7 +137,7 @@ class AlwaysOnTop extends EventEmitter {
if (!this._aotWindow) {
return;
}

if (!this._jitsiMeetLargeVideo) {
this._aotWindowVideo.style.display = 'none';
this._aotWindowVideo.srcObject = null;
Expand Down Expand Up @@ -240,7 +241,7 @@ class AlwaysOnTop extends EventEmitter {

/**
* Disposes the aot window
*
*
*/
_disposeWindow() {
logInfo('disposing window');
Expand Down
2 changes: 2 additions & 0 deletions powermonitor/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ function dispose() {
module.exports = function setupPowerMonitorRender(api) {
const iframe = api.getIFrame();

api.on('_willDispose', dispose);

iframe.addEventListener('load', () => {
iframe.contentWindow.addEventListener(
'unload',
Expand Down

0 comments on commit 6724c78

Please sign in to comment.