fix(core): remove NgZone_ and use NgZone instead

This commit is contained in:
vsavkin
2015-10-08 13:33:22 -07:00
parent bc8c194665
commit bba0248989
17 changed files with 166 additions and 198 deletions

View File

@ -293,7 +293,3 @@ class NgZone {
zoneValues: {'_innerZone': true});
}
}
class NgZone_ extends NgZone {
NgZone_({bool enableLongStackTrace}) : super(enableLongStackTrace: enableLongStackTrace);
}

View File

@ -77,35 +77,7 @@ export interface NgZoneZone extends Zone { _innerZone: boolean; }
* }
* ```
*/
export abstract class NgZone {
/**
* Executes the `fn` function synchronously within the Angular zone and returns value returned by
* the function.
*
* Running functions via `run` allows you to reenter Angular zone from a task that was executed
* outside of the Angular zone (typically started via {@link #runOutsideAngular}).
*
* Any future tasks or microtasks scheduled from within this function will continue executing from
* within the Angular zone.
*/
abstract run(fn: () => any): any;
/**
* Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
* the function.
*
* Running functions via `runOutsideAngular` allows you to escape Angular's zone and do work that
* doesn't trigger Angular change-detection or is subject to Angular's error handling.
*
* Any future tasks or microtasks scheduled from within this function will continue executing from
* outside of the Angular zone.
*
* Use {@link #run} to reenter the Angular zone and do work that updates the application model.
*/
abstract runOutsideAngular(fn: () => any): any;
}
export class NgZone_ extends NgZone {
export class NgZone {
_runScope: WtfScopeFn = wtfCreateScope(`NgZone#run()`);
_microtaskScope: WtfScopeFn = wtfCreateScope(`NgZone#microtask()`);
@ -143,7 +115,6 @@ export class NgZone_ extends NgZone {
* enabled in development mode as they significantly impact perf.
*/
constructor({enableLongStackTrace}) {
super();
this._onTurnStart = null;
this._onTurnDone = null;
this._onEventDone = null;
@ -222,6 +193,16 @@ export class NgZone_ extends NgZone {
this._onErrorHandler = normalizeBlank(errorHandler);
}
/**
* Executes the `fn` function synchronously within the Angular zone and returns value returned by
* the function.
*
* Running functions via `run` allows you to reenter Angular zone from a task that was executed
* outside of the Angular zone (typically started via {@link #runOutsideAngular}).
*
* Any future tasks or microtasks scheduled from within this function will continue executing from
* within the Angular zone.
*/
run(fn: () => any): any {
if (this._disabled) {
return fn();
@ -235,6 +216,18 @@ export class NgZone_ extends NgZone {
}
}
/**
* Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
* the function.
*
* Running functions via `runOutsideAngular` allows you to escape Angular's zone and do work that
* doesn't trigger Angular change-detection or is subject to Angular's error handling.
*
* Any future tasks or microtasks scheduled from within this function will continue executing from
* outside of the Angular zone.
*
* Use {@link #run} to reenter the Angular zone and do work that updates the application model.
*/
runOutsideAngular(fn: () => any): any {
if (this._disabled) {
return fn();