Skip to content

Commit

Permalink
Merge d4ebee2 into 7818176
Browse files Browse the repository at this point in the history
  • Loading branch information
zwu52 authored Aug 23, 2021
2 parents 7818176 + d4ebee2 commit 8c5137c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages-exp/messaging-compat/src/registerMessagingCompat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ declare module '@firebase/component' {
const messagingCompatFactory: InstanceFactory<'messaging-compat'> = (
container: ComponentContainer
) => {
if (!!navigator) {
// in window
if (self && 'ServiceWorkerGlobalScope' in self) {
// in sw
return new MessagingCompatImpl(
container.getProvider('app-compat').getImmediate(),
container.getProvider('messaging-exp').getImmediate()
container.getProvider('messaging-sw-exp').getImmediate()
);
} else {
// in sw
// in window
return new MessagingCompatImpl(
container.getProvider('app-compat').getImmediate(),
container.getProvider('messaging-sw-exp').getImmediate()
container.getProvider('messaging-exp').getImmediate()
);
}
};
Expand Down

0 comments on commit 8c5137c

Please sign in to comment.