1- import { InjectionToken , NgZone } from '@angular/core' ;
2- import { Observable } from 'rxjs/Observable' ;
3- import { Subscription } from 'rxjs/Subscription' ;
4- import { queue } from 'rxjs/scheduler/queue' ;
5- import { isPlatformServer } from '@angular/common' ;
6- import { observeOn } from 'rxjs/operator/observeOn' ;
1+ import 'rxjs/add/operator/first' ;
72
3+ import { isPlatformServer } from '@angular/common' ;
4+ import { InjectionToken , NgZone } from '@angular/core' ;
85import firebase from '@firebase/app' ;
9- import { FirebaseApp , FirebaseOptions } from '@firebase/app-types' ;
10-
11- import 'zone.js' ;
12- import 'rxjs/add/operator/first' ;
6+ import { FirebaseApp , FirebaseOptions } from '@firebase/app-types' ;
7+ import { Observable } from 'rxjs/Observable' ;
8+ import { observeOn } from 'rxjs/operator/observeOn' ;
9+ import { queue } from 'rxjs/scheduler/queue' ;
10+ import { Subscription } from 'rxjs/Subscription' ;
11+ import { } from 'zone.js' ;
1312
14- export const FirebaseAppName = new InjectionToken < string > ( 'angularfire2.appName' ) ;
15- export const FirebaseAppConfig = new InjectionToken < FirebaseOptions > ( 'angularfire2.config' ) ;
13+ export const FirebaseAppName =
14+ new InjectionToken < string > ( 'angularfire2.appName' ) ;
15+ export const FirebaseAppConfig =
16+ new InjectionToken < FirebaseOptions > ( 'angularfire2.config' ) ;
1617
1718// Put in database.ts when we drop database-depreciated
18- export const RealtimeDatabaseURL = new InjectionToken < string > ( 'angularfire2.realtimeDatabaseURL' ) ;
19+ export const RealtimeDatabaseURL =
20+ new InjectionToken < string > ( 'angularfire2.realtimeDatabaseURL' ) ;
1921
2022export class FirebaseZoneScheduler {
2123 constructor ( public zone : NgZone , private platformId : Object ) { }
2224 schedule ( ...args : any [ ] ) : Subscription {
23- return < Subscription > this . zone . runGuarded ( function ( ) { return queue . schedule . apply ( queue , args ) } ) ;
25+ return < Subscription > this . zone . runGuarded ( function ( ) {
26+ return queue . schedule . apply ( queue , args )
27+ } ) ;
2428 }
2529 // TODO this is a hack, clean it up
2630 keepUnstableUntilFirst < T > ( obs$ : Observable < T > ) {
2731 if ( isPlatformServer ( this . platformId ) ) {
2832 return new Observable < T > ( subscriber => {
2933 const noop = ( ) => { } ;
30- const task = Zone . current . scheduleMacroTask ( 'firebaseZoneBlock' , noop , { } , noop , noop ) ;
31- obs$ . first ( ) . subscribe ( ( ) => this . zone . runOutsideAngular ( ( ) => task . invoke ( ) ) ) ;
34+ const task = Zone . current . scheduleMacroTask (
35+ 'firebaseZoneBlock' , noop , { } , noop , noop ) ;
36+ obs$ . first ( ) . subscribe (
37+ ( ) => this . zone . runOutsideAngular ( ( ) => task . invoke ( ) ) ) ;
3238 return obs$ . subscribe ( subscriber ) ;
3339 } ) ;
3440 } else {
@@ -39,11 +45,11 @@ export class FirebaseZoneScheduler {
3945 return new Observable < T > ( subscriber => {
4046 return this . zone . runOutsideAngular ( ( ) => {
4147 return obs$ . subscribe (
42- value => this . zone . run ( ( ) => subscriber . next ( value ) ) ,
43- error => this . zone . run ( ( ) => subscriber . error ( error ) ) ,
44- ( ) => this . zone . run ( ( ) => subscriber . complete ( ) ) ,
48+ value => this . zone . run ( ( ) => subscriber . next ( value ) ) ,
49+ error => this . zone . run ( ( ) => subscriber . error ( error ) ) ,
50+ ( ) => this . zone . run ( ( ) => subscriber . complete ( ) ) ,
4551 ) ;
4652 } ) ;
4753 } ) ;
4854 }
49- }
55+ }
0 commit comments