chore: update public api and integrate minor review comments
This commit is contained in:
@ -23,7 +23,7 @@ export const APP_INITIALIZER: any = new OpaqueToken('Application Initializer');
|
||||
* @experimental
|
||||
*/
|
||||
@Injectable()
|
||||
export class AppInitStatus {
|
||||
export class ApplicationInitStatus {
|
||||
private _donePromise: Promise<any>;
|
||||
private _done = false;
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import {Type} from '../src/facade/lang';
|
||||
|
||||
import {AppInitStatus} from './application_init';
|
||||
import {ApplicationInitStatus} from './application_init';
|
||||
import {ApplicationRef, ApplicationRef_, isDevMode} from './application_ref';
|
||||
import {APP_ID_RANDOM_PROVIDER} from './application_tokens';
|
||||
import {IterableDiffers, KeyValueDiffers, defaultIterableDiffers, defaultKeyValueDiffers} from './change_detection/change_detection';
|
||||
@ -45,7 +45,7 @@ export const APPLICATION_COMMON_PROVIDERS: Array<Type|{[k: string]: any}|any[]>
|
||||
providers: [
|
||||
ApplicationRef_,
|
||||
{provide: ApplicationRef, useExisting: ApplicationRef_},
|
||||
AppInitStatus,
|
||||
ApplicationInitStatus,
|
||||
Compiler,
|
||||
{provide: ComponentResolver, useExisting: Compiler},
|
||||
APP_ID_RANDOM_PROVIDER,
|
||||
|
@ -11,7 +11,7 @@ import {ListWrapper} from '../src/facade/collection';
|
||||
import {BaseException, ExceptionHandler, unimplemented} from '../src/facade/exceptions';
|
||||
import {ConcreteType, Type, isBlank, isPresent, isPromise, stringify} from '../src/facade/lang';
|
||||
|
||||
import {AppInitStatus} from './application_init';
|
||||
import {ApplicationInitStatus} from './application_init';
|
||||
import {APP_BOOTSTRAP_LISTENER, PLATFORM_INITIALIZER} from './application_tokens';
|
||||
import {ChangeDetectorRef} from './change_detection/change_detector_ref';
|
||||
import {Console} from './console';
|
||||
@ -275,7 +275,7 @@ export abstract class PlatformRef {
|
||||
abstract destroy(): void;
|
||||
|
||||
/**
|
||||
* @deprecated Use `destroyd` instead
|
||||
* @deprecated Use `destroyed` instead
|
||||
*/
|
||||
get disposed(): boolean { throw unimplemented(); }
|
||||
get destroyed(): boolean { throw unimplemented(); }
|
||||
@ -327,7 +327,7 @@ export class PlatformRef_ extends PlatformRef {
|
||||
|
||||
destroy() {
|
||||
if (this._destroyed) {
|
||||
throw new BaseException('The platform is already destroyed!');
|
||||
throw new BaseException('The platform has already been destroyed!');
|
||||
}
|
||||
ListWrapper.clone(this._modules).forEach((app) => app.destroy());
|
||||
this._destroyListeners.forEach((dispose) => dispose());
|
||||
@ -360,7 +360,7 @@ export class PlatformRef_ extends PlatformRef {
|
||||
exceptionHandler.call(error.error, error.stackTrace);
|
||||
});
|
||||
return _callAndReportToExceptionHandler(exceptionHandler, () => {
|
||||
const initStatus: AppInitStatus = moduleRef.injector.get(AppInitStatus);
|
||||
const initStatus: ApplicationInitStatus = moduleRef.injector.get(ApplicationInitStatus);
|
||||
return initStatus.donePromise.then(() => {
|
||||
this._moduleDoBootstrap(moduleRef);
|
||||
return moduleRef;
|
||||
@ -421,7 +421,7 @@ export abstract class ApplicationRef {
|
||||
* Returns a promise that resolves when all asynchronous application initializers
|
||||
* are done.
|
||||
*
|
||||
* @deprecated Use the {@link AppInitStatus} class instead.
|
||||
* @deprecated Use the {@link ApplicationInitStatus} class instead.
|
||||
*/
|
||||
abstract waitForAsyncInitializers(): Promise<any>;
|
||||
|
||||
@ -514,7 +514,7 @@ export class ApplicationRef_ extends ApplicationRef {
|
||||
private _zone: NgZone, private _console: Console, private _injector: Injector,
|
||||
private _exceptionHandler: ExceptionHandler,
|
||||
private _componentFactoryResolver: ComponentFactoryResolver,
|
||||
private _initStatus: AppInitStatus,
|
||||
private _initStatus: ApplicationInitStatus,
|
||||
@Optional() private _testabilityRegistry: TestabilityRegistry,
|
||||
@Optional() private _testability: Testability) {
|
||||
super();
|
||||
|
@ -48,7 +48,10 @@ function _randomChar(): string {
|
||||
export const PLATFORM_INITIALIZER: any = new OpaqueToken('Platform Initializer');
|
||||
|
||||
/**
|
||||
* All callbacks provided via this token will be called when a component has been bootstrapped.
|
||||
* All callbacks provided via this token will be called for every component that is bootstrapped.
|
||||
* Signature of the callback:
|
||||
*
|
||||
* `(componentRef: ComponentRef) => void`.
|
||||
*
|
||||
* @experimental
|
||||
*/
|
||||
|
@ -108,7 +108,7 @@ export abstract class NgModuleInjector<T> extends CodegenComponentFactoryResolve
|
||||
destroy(): void {
|
||||
if (this._destroyed) {
|
||||
throw new BaseException(
|
||||
`This module is already destroyed (${stringify(this.instance.constructor)})`);
|
||||
`The ng module ${stringify(this.instance.constructor)} has already been destroyed.`);
|
||||
}
|
||||
this._destroyed = true;
|
||||
this.destroyInternal();
|
||||
|
@ -150,9 +150,9 @@ export class NgModuleMetadata extends InjectableMetadata implements NgModuleMeta
|
||||
* this module is bootstrapped. The components listed here
|
||||
* will automatically be added to `entryComponents`.
|
||||
*/
|
||||
bootstrap: Array<Type|any[]>
|
||||
bootstrap: Array<Type|any[]>;
|
||||
|
||||
schemas: Array<SchemaMetadata|any[]>;
|
||||
schemas: Array<SchemaMetadata|any[]>;
|
||||
|
||||
constructor(options: NgModuleMetadataType = {}) {
|
||||
// We cannot use destructuring of the constructor argument because `exports` is a
|
||||
|
Reference in New Issue
Block a user