Stub broadcast channel for unspported contexts (#2175)

zio/stable
Eric Bailey 2023-12-12 13:19:27 -06:00 committed by GitHub
parent c6ab6e8b8e
commit e7141a77d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 12 deletions

View File

@ -1,11 +1,2 @@
export default class BroadcastChannel { import Stub from '#/lib/broadcast/stub'
constructor(public name: string) {} export default Stub
postMessage(_data: any) {}
close() {}
onmessage: (event: MessageEvent) => void = () => {}
addEventListener(_type: string, _listener: (event: MessageEvent) => void) {}
removeEventListener(
_type: string,
_listener: (event: MessageEvent) => void,
) {}
}

View File

@ -1 +1,2 @@
export default BroadcastChannel import Stub from '#/lib/broadcast/stub'
export default 'BroadcastChannel' in window ? window.BroadcastChannel : Stub

View File

@ -0,0 +1,11 @@
export default class BroadcastChannel {
constructor(public name: string) {}
postMessage(_data: any) {}
close() {}
onmessage: (event: MessageEvent) => void = () => {}
addEventListener(_type: string, _listener: (event: MessageEvent) => void) {}
removeEventListener(
_type: string,
_listener: (event: MessageEvent) => void,
) {}
}