File tree Expand file tree Collapse file tree 1 file changed +11
-20
lines changed Expand file tree Collapse file tree 1 file changed +11
-20
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,18 @@ export function addSessionIdListener(
5454/** Creates a listener source for a streamer's private data with a pull key. */ 
5555export  function  forPullKey ( pullKey : string )  { 
5656  const  db  =  getDatabase ( getApp ( ) ) ; 
57+   const  analytics  =  getAnalytics ( getApp ( ) ) ; 
5758  const  reference  =  child ( ref ( db ,  "pullables" ) ,  pullKey ) ; 
59+   const  safeLogEvent  =  ( eventName : string ,  eventParams ?: any )  =>  { 
60+     isSupported ( ) 
61+       . then ( ( supported )  =>  { 
62+         if  ( supported )  { 
63+           logEvent ( analytics ,  eventName ,  eventParams ) ; 
64+         } 
65+       } ) 
66+       . catch ( ( )  =>  { } ) ; 
67+   } ; 
68+ 
5869  return  { 
5970    addLocationListener ( callback : ( location : Location )  =>  void )  { 
6071      safeLogEvent ( "listener" ,  {  type : "location" ,  pullKey } ) ; 
@@ -188,23 +199,3 @@ function getApp() {
188199  } 
189200  return  app ; 
190201} 
191- 
192- const  safeLogEvent  =  ( ( )  =>  { 
193-   let  analyticsInstance : Analytics  |  null  =  null ; 
194- 
195-   return  ( eventName : string ,  eventParams ?: any )  =>  { 
196-     if  ( analyticsInstance )  { 
197-       logEvent ( analyticsInstance ,  eventName ,  eventParams ) ; 
198-       return ; 
199-     } 
200- 
201-     isSupported ( ) 
202-       . then ( ( supported )  =>  { 
203-         if  ( supported )  { 
204-           analyticsInstance  =  getAnalytics ( getApp ( ) ) ; 
205-           logEvent ( analyticsInstance ,  eventName ,  eventParams ) ; 
206-         } 
207-       } ) 
208-       . catch ( ( )  =>  { } ) ; 
209-   } ; 
210- } ) ( ) ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments