@@ -35,18 +35,18 @@ const ANNOTATIONS = '__annotations__';
3535export class ScreenTrackingService implements OnDestroy {
3636
3737 private disposable : Subscription | undefined ;
38-
38+
3939 constructor (
4040 analytics : AngularFireAnalytics ,
41- @Optional ( ) router :Router ,
42- @Optional ( ) title :Title ,
41+ @Optional ( ) router : Router ,
42+ @Optional ( ) title : Title ,
4343 componentFactoryResolver : ComponentFactoryResolver ,
44- @Inject ( PLATFORM_ID ) platformId :Object ,
45- @Optional ( ) @Inject ( DEBUG_MODE ) debugModeEnabled :boolean | null ,
44+ @Inject ( PLATFORM_ID ) platformId : Object ,
45+ @Optional ( ) @Inject ( DEBUG_MODE ) debugModeEnabled : boolean | null ,
4646 zone : NgZone ,
4747 injector : Injector
4848 ) {
49- if ( ! router || ! isPlatformBrowser ( platformId ) ) { return this }
49+ if ( ! router || ! isPlatformBrowser ( platformId ) ) { return this ; }
5050 zone . runOutsideAngular ( ( ) => {
5151 const activationEndEvents = router . events . pipe ( filter < ActivationEnd > ( e => e instanceof ActivationEnd ) ) ;
5252 const navigationEndEvents = router . events . pipe ( filter < NavigationEnd > ( e => e instanceof NavigationEnd ) ) ;
@@ -64,13 +64,13 @@ export class ScreenTrackingService implements OnDestroy {
6464 [ OUTLET_KEY ] : activationEnd . snapshot . outlet
6565 } ;
6666 if ( title ) {
67- params [ PAGE_TITLE_KEY ] = title . getTitle ( )
67+ params [ PAGE_TITLE_KEY ] = title . getTitle ( ) ;
6868 }
6969 const component = activationEnd . snapshot . component ;
7070 const routeConfig = activationEnd . snapshot . routeConfig ;
7171 const loadChildren = routeConfig && routeConfig . loadChildren ;
7272 // TODO figure out how to handle minification
73- if ( typeof loadChildren === " string" ) {
73+ if ( typeof loadChildren === ' string' ) {
7474 // SEMVER: this is the older lazy load style "./path#ClassName", drop this when we drop old ng
7575 // TODO is it worth seeing if I can look up the component factory selector from the module name?
7676 // it's lazy so it's not registered with componentFactoryResolver yet... seems a pain for a depreciated style
@@ -82,7 +82,7 @@ export class ScreenTrackingService implements OnDestroy {
8282 return of ( { ...params , [ SCREEN_CLASS_KEY ] : componentFactory . selector } ) ;
8383 } else if ( loadChildren ) {
8484 const loadedChildren = loadChildren ( ) ;
85- var loadedChildren$ : Observable < any > = ( loadedChildren instanceof Observable ) ? loadedChildren : from ( Promise . resolve ( loadedChildren ) ) ;
85+ const loadedChildren$ : Observable < any > = ( loadedChildren instanceof Observable ) ? loadedChildren : from ( Promise . resolve ( loadedChildren ) ) ;
8686 return loadedChildren$ . pipe (
8787 map ( lazyModule => {
8888 if ( lazyModule instanceof NgModuleFactory ) {
@@ -94,14 +94,14 @@ export class ScreenTrackingService implements OnDestroy {
9494 try {
9595 const componentFactory = moduleRef . componentFactoryResolver . resolveComponentFactory ( component ! ) ;
9696 return { ...params , [ SCREEN_CLASS_KEY ] : componentFactory . selector } ;
97- } catch ( _ ) {
97+ } catch ( _ ) {
9898 return { ...params , [ SCREEN_CLASS_KEY ] : DEFAULT_SCREEN_CLASS } ;
9999 }
100100 } else {
101101 // JIT look at the annotations
102102 // INVESTIGATE are there public APIs for this stuff?
103- const declarations = [ ] . concat . apply ( [ ] , ( lazyModule [ ANNOTATIONS ] || [ ] ) . map ( ( f :any ) => f . declarations ) ) ;
104- const selectors = [ ] . concat . apply ( [ ] , declarations . map ( ( c :any ) => ( c [ ANNOTATIONS ] || [ ] ) . map ( ( f :any ) => f . selector ) ) ) ;
103+ const declarations = [ ] . concat . apply ( [ ] , ( lazyModule [ ANNOTATIONS ] || [ ] ) . map ( ( f : any ) => f . declarations ) ) ;
104+ const selectors = [ ] . concat . apply ( [ ] , declarations . map ( ( c : any ) => ( c [ ANNOTATIONS ] || [ ] ) . map ( ( f : any ) => f . selector ) ) ) ;
105105 // should I just be grabbing the selector like this or should i match against the route component?
106106 // const routerModule = lazyModule.ngInjectorDef.imports.find(i => i.ngModule && ....);
107107 // const route = routerModule.providers[0].find(p => p.provide == ROUTES).useValue[0];
@@ -127,7 +127,7 @@ export class ScreenTrackingService implements OnDestroy {
127127 [ SCREEN_CLASS_KEY ] : params [ SCREEN_CLASS_KEY ]
128128 } ) ;
129129 if ( title ) {
130- analytics . updateConfig ( { [ PAGE_TITLE_KEY ] : params [ PAGE_TITLE_KEY ] } )
130+ analytics . updateConfig ( { [ PAGE_TITLE_KEY ] : params [ PAGE_TITLE_KEY ] } ) ;
131131 }
132132 }
133133 } ) ,
@@ -144,11 +144,11 @@ export class ScreenTrackingService implements OnDestroy {
144144 ) . subscribe ( ) ;
145145 } ) ;
146146 }
147-
147+
148148 ngOnDestroy ( ) {
149149 if ( this . disposable ) { this . disposable . unsubscribe ( ) ; }
150150 }
151-
151+
152152}
153153
154154@Injectable ( {
@@ -162,7 +162,7 @@ export class UserTrackingService implements OnDestroy {
162162 constructor (
163163 analytics : AngularFireAnalytics ,
164164 zone : NgZone ,
165- @Inject ( PLATFORM_ID ) platformId :Object
165+ @Inject ( PLATFORM_ID ) platformId : Object
166166 ) {
167167 const schedulers = new ɵAngularFireSchedulers ( zone ) ;
168168
@@ -186,11 +186,11 @@ export class UserTrackingService implements OnDestroy {
186186}
187187
188188// this is an INT64 in iOS/Android but use INT32 cause javascript
189- let nextScreenInstanceID = Math . floor ( Math . random ( ) * ( 2 ** 32 - 1 ) ) - 2 ** 31 ;
189+ let nextScreenInstanceID = Math . floor ( Math . random ( ) * ( 2 ** 32 - 1 ) ) - 2 ** 31 ;
190190
191- const knownScreenInstanceIDs : { [ key :string ] : number } = { } ;
191+ const knownScreenInstanceIDs : { [ key : string ] : number } = { } ;
192192
193- const getScreenInstanceID = ( params :{ [ key :string ] : any } ) => {
193+ const getScreenInstanceID = ( params : { [ key : string ] : any } ) => {
194194 // unique the screen class against the outlet name
195195 const screenInstanceKey = [
196196 params [ SCREEN_CLASS_KEY ] ,
@@ -203,4 +203,4 @@ const getScreenInstanceID = (params:{[key:string]: any}) => {
203203 knownScreenInstanceIDs [ screenInstanceKey ] = ret ;
204204 return ret ;
205205 }
206- }
206+ } ;
0 commit comments