Cleanup intervals on destroyed views extension

This commit is contained in:
Tom Moor
2023-06-25 22:52:28 -04:00
parent 94882d4d3a
commit edb9099c9d
3 changed files with 14 additions and 2 deletions

View File

@@ -70,4 +70,15 @@ export class ViewsExtension implements Extension {
this.intervalsBySocket.delete(socketId);
}
}
/**
* onDestroy hook
* @param data The destroy payload
*/
async onDestroy() {
this.intervalsBySocket.forEach((interval, socketId) => {
clearInterval(interval);
this.intervalsBySocket.delete(socketId);
});
}
}