Files
doneit-web/.angular/cache/14.2.12/babel-webpack/a71132cab706bd023a719535cedc31d1.json
T

1 line
33 KiB
JSON
Raw Normal View History

2023-06-30 09:54:21 +01:00
{"ast":null,"code":"import { queueScheduler, asyncScheduler } from 'rxjs';\nimport { tap, subscribeOn, observeOn } from 'rxjs/operators';\nimport { InjectionToken, Version, isDevMode, NgZone, Optional, VERSION as VERSION$1, NgModule, Inject, PLATFORM_ID } from '@angular/core';\nimport firebase from 'firebase/app';\nimport * as ɵngcc0 from '@angular/core';\nfunction noop() {}\n/**\n * Schedules tasks so that they are invoked inside the Zone that is passed in the constructor.\n */\n// tslint:disable-next-line:class-name\nclass ɵZoneScheduler {\n constructor(zone, delegate = queueScheduler) {\n this.zone = zone;\n this.delegate = delegate;\n }\n now() {\n return this.delegate.now();\n }\n schedule(work, delay, state) {\n const targetZone = this.zone;\n // Wrap the specified work function to make sure that if nested scheduling takes place the\n // work is executed in the correct zone\n const workInZone = function (state) {\n targetZone.runGuarded(() => {\n work.apply(this, [state]);\n });\n };\n // Scheduling itself needs to be run in zone to ensure setInterval calls for async scheduling are done\n // inside the correct zone. This scheduler needs to schedule asynchronously always to ensure that\n // firebase emissions are never synchronous. Specifying a delay causes issues with the queueScheduler delegate.\n return this.delegate.schedule(workInZone, delay, state);\n }\n}\n// tslint:disable-next-line:class-name\nclass ɵBlockUntilFirstOperator {\n constructor(zone) {\n this.zone = zone;\n this.task = null;\n }\n call(subscriber, source) {\n const unscheduleTask = this.unscheduleTask.bind(this);\n this.task = this.zone.run(() => Zone.current.scheduleMacroTask('firebaseZoneBlock', noop, {}, noop, noop));\n return source.pipe(tap({\n next: unscheduleTask,\n complete: unscheduleTask,\n error: unscheduleTask\n })).subscribe(subscriber).add(unscheduleTask);\n }\n unscheduleTask() {\n // maybe this is a race condition, invoke in a timeout\n // hold for 10ms while I try to figure out what is going on\n setTimeout(() => {\n if (this.task != null && this.task.state === 'scheduled') {\n this.task.invoke();\n this.task = null;\n }\n }, 10);\n }\n}\n// tslint:disable-next-line:class-name\nclass ɵAngularFireSchedulers {\n constructor(ngZone) {\n this.ngZone = ngZone;\n this.outsideAngular = ngZone.runOutsideAngular(() => new ɵZoneScheduler(Zone.current));\n this.insideAngular = ngZone.run(() => new ɵZoneScheduler(Zone.current, asyncScheduler));\n }\n}\n/**\n * Operator to block the zone until the first value has been emitted or the observable\n * has completed/errored. This is used to make sure that universal waits until the first\n * value from firebase but doesn't block the zone forever since the firebase subscription\n * is still alive.\n */\nfunction ɵkeepUnstableUntilFirstFactory(schedulers) {\n return function keepUnstableUntilFirst(obs$) {\n obs$ = obs$.lift(new ɵBlockUntilFirstOperator(schedulers.ngZone));\n return obs$.pipe(\n // Run the subscribe body outside of Angular (e.g. calling Firebase SDK to add a listener to a change event)\n subscribeOn(schedulers.outsideAngular),\n // Run operators inside the angular zone (e.g. side effects via tap())\n observeOn(schedulers.insideAngular)\n // INVESTIGATE https://github.com/angular/angularfire/pull/2315\n // share()\n );\n };\n}\n// DEBUG quick debugger function for inline logging that typescript doesn't complain about\n// wrote it for debugging the ɵlazySDKProxy, commenting out for now; should consider exposing a\n// verbose mode for AngularFire in a future release that uses something like this in multiple places\n// usage: () => log('something') || returnValue\n// const log = (...args: any[]): false => { console.log(...args); return false }\n// The problem here are things like ngOnDestroy are missing, then triggering the service\n// rather than dig too far; I'm capturing these as I go.\