feat(core): PlatformRef and ApplicationRef support registration of disposal functions.
These functions will be called whenever the platform or application are being disposed.
This commit is contained in:
24
modules/angular2/src/mock/mock_application_ref.ts
Normal file
24
modules/angular2/src/mock/mock_application_ref.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import {ApplicationRef} from 'angular2/src/core/application_ref';
|
||||
import {Type} from 'angular2/src/core/facade/lang';
|
||||
import {ComponentRef} from 'angular2/src/core/linker/dynamic_component_loader';
|
||||
import {Provider, Injector} from 'angular2/src/core/di';
|
||||
import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
||||
import {Promise} from 'angular2/src/core/facade/async';
|
||||
|
||||
export class MockApplicationRef extends ApplicationRef {
|
||||
registerBootstrapListener(listener: (ref: ComponentRef) => void): void {}
|
||||
|
||||
registerDisposeListener(dispose: () => void): void {}
|
||||
|
||||
bootstrap(componentType: Type, bindings?: Array<Type | Provider | any[]>): Promise<ComponentRef> {
|
||||
return null;
|
||||
}
|
||||
|
||||
get injector(): Injector { return null; };
|
||||
|
||||
get zone(): NgZone { return null; };
|
||||
|
||||
dispose(): void {}
|
||||
|
||||
get componentTypes(): Type[] { return null; };
|
||||
}
|
Reference in New Issue
Block a user