File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
packages-exp/messaging-compat/src Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import {
22
22
InstanceFactory
23
23
} from '@firebase/component' ;
24
24
import firebase , { _FirebaseNamespace } from '@firebase/app-compat' ;
25
+
25
26
import { MessagingCompatImpl } from './messaging-compat' ;
26
27
27
28
declare module '@firebase/component' {
@@ -33,10 +34,19 @@ declare module '@firebase/component' {
33
34
const messagingCompatFactory : InstanceFactory < 'messaging-compat' > = (
34
35
container : ComponentContainer
35
36
) => {
36
- return new MessagingCompatImpl (
37
- container . getProvider ( 'app-compat' ) . getImmediate ( ) ,
38
- container . getProvider ( 'messaging-exp' ) . getImmediate ( )
39
- ) ;
37
+ if ( ! ! navigator ) {
38
+ // in window
39
+ return new MessagingCompatImpl (
40
+ container . getProvider ( 'app-compat' ) . getImmediate ( ) ,
41
+ container . getProvider ( 'messaging-exp' ) . getImmediate ( )
42
+ ) ;
43
+ } else {
44
+ // in sw
45
+ return new MessagingCompatImpl (
46
+ container . getProvider ( 'app-compat' ) . getImmediate ( ) ,
47
+ container . getProvider ( 'messaging-sw-exp' ) . getImmediate ( )
48
+ ) ;
49
+ }
40
50
} ;
41
51
42
52
export function registerMessagingCompat ( ) : void {
You can’t perform that action at this time.
0 commit comments