Skip to content

Commit 084fa1f

Browse files
fix: allow graceful failure if serviceWorker is unavailable
1 parent 51465ce commit 084fa1f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/messaging/src/helpers/register.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ import { name, version } from '../../package.json';
4040
const WindowMessagingFactory: InstanceFactory<'messaging'> = (
4141
container: ComponentContainer
4242
) => {
43+
if (!navigator.serviceWorker) {
44+
console.warn("Service workers are not supported in this environment.");
45+
return;
46+
}
47+
4348
const messaging = new MessagingService(
4449
container.getProvider('app').getImmediate(),
4550
container.getProvider('installations-internal').getImmediate(),

0 commit comments

Comments
 (0)