Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
});
handles.push({ event: 'child_changed', handle: chgFn });
return () => {
// Loop through callback handles and dispose of each event with handle
// The Firebase SDK requires the reference, event name, and callback to
// properly unsubscribe, otherwise it can affect other subscriptions.
handles.forEach(item => {
ref.off(item.event, item.handle);
});
};
});
// TODO: should be in the subscription zone instead
return observeOn.call(listObs, new FirebaseZoneScheduler(new NgZone({}), {}));
}
constructor(
@Inject(FirebaseAppConfig) config:FirebaseOptions,
@Optional() @Inject(FirebaseAppName) name:string,
private zone: NgZone
) {
const scheduler = new FirebaseZoneScheduler(zone);
this.auth = zone.runOutsideAngular(() => {
const app = _firebaseAppFactory(config, name);
return app.auth();
});
this.authState = scheduler.keepUnstableUntilFirst(
scheduler.runOutsideAngular(
new Observable(subscriber => {
const unsubscribe = this.auth.onAuthStateChanged(subscriber);
return { unsubscribe };
})
)
);
this.idToken = scheduler.keepUnstableUntilFirst(
scheduler.runOutsideAngular(
constructor(
@Inject(FirebaseAppConfig) config:FirebaseOptions,
@Optional() @Inject(FirebaseAppName) name:string,
@Optional() @Inject(EnablePersistenceToken) shouldEnablePersistence: boolean,
zone: NgZone
) {
this.scheduler = new FirebaseZoneScheduler(zone);
this.firestore = zone.runOutsideAngular(() => {
const app = _firebaseAppFactory(config, name);
return app.firestore();
});
this.persistenceEnabled$ = zone.runOutsideAngular(() => {
return shouldEnablePersistence ?
from(this.firestore.enablePersistence().then(() => true, () => false)) :
from(new Promise((res, rej) => { res(false); }));
});
}