refactor(core): tree-shake application_module providers (#23477)

PR Close #23477
This commit is contained in:
Matias Niemelä
2018-04-23 10:47:27 -07:00
committed by Igor Minar
parent b4c252bcc5
commit eb031c6ff1
8 changed files with 61 additions and 20 deletions

View File

@ -8,7 +8,9 @@
import {isPromise} from '../src/util/lang';
import {Inject, Injectable, InjectionToken, Optional} from './di';
import {Inject, Injectable, InjectionToken, Optional, inject} from './di';
import {defineInjectable} from './di/defs';
/**
@ -22,8 +24,22 @@ export const APP_INITIALIZER = new InjectionToken<Array<() => void>>('Applicatio
*
* @experimental
*/
@Injectable()
export class ApplicationInitStatus {
// `ngInjectableDef` is required in core-level code because it sits behind
// the injector and any code the loads it inside may run into a dependency
// loop (because Injectable is also in core. Do not use the code below
// (use @Injectable({ providedIn, factory })) instead...
/**
* @internal
* @nocollapse
*/
static ngInjectableDef = defineInjectable({
providedIn: 'root',
factory: function ApplicationInitStatus_Factory() {
return new ApplicationInitStatus(inject(APP_INITIALIZER));
}
});
private resolve: Function;
private reject: Function;
private initialized = false;