Check for BroadcastChannel availability before instantiating it

This commit is contained in:
schlagmichdoch 2024-11-11 15:37:04 +01:00
parent 659b53b5fa
commit 44c0f3dbaa

View file

@ -1,5 +1,7 @@
class BrowserTabsConnector {
constructor() {
if (!('BroadcastChannel' in window)) return;
this.bc = new BroadcastChannel('pairdrop');
this.bc.addEventListener('message', e => this._onMessage(e));
Events.on('broadcast-send', e => this._broadcastSend(e.detail));