refactor(NgZone): improve types

Closes #4642
This commit is contained in:
Victor Berchet 2015-10-09 14:43:22 -07:00
parent 6207b1af88
commit 393b0526b4
2 changed files with 8 additions and 17 deletions

View File

@ -93,14 +93,14 @@ export class NgZone {
_onErrorHandler: (error: any, stack: any) => void;
// Number of microtasks pending from _innerZone (& descendants)
_pendingMicrotasks: number;
_pendingMicrotasks: number = 0;
// Whether some code has been executed in the _innerZone (& descendants) in the current turn
_hasExecutedCodeInInnerZone: boolean;
_hasExecutedCodeInInnerZone: boolean = false;
// run() call depth in _mountZone. 0 at the end of a macrotask
// zone.run(() => { // top-level call
// zone.run(() => {}); // nested call -> in-turn
// });
_nestedRun: number;
_nestedRun: number = 0;
// TODO(vicb): implement this class properly for node.js environment
// This disabled flag is only here to please cjs tests
@ -115,15 +115,6 @@ export class NgZone {
* enabled in development mode as they significantly impact perf.
*/
constructor({enableLongStackTrace}) {
this._onTurnStart = null;
this._onTurnDone = null;
this._onEventDone = null;
this._onErrorHandler = null;
this._pendingMicrotasks = 0;
this._hasExecutedCodeInInnerZone = false;
this._nestedRun = 0;
if (global.zone) {
this._disabled = false;
this._mountZone = global.zone;
@ -142,7 +133,7 @@ export class NgZone {
*
* Setting the hook overrides any previously set hook.
*/
overrideOnTurnStart(onTurnStartHook: Function): void {
overrideOnTurnStart(onTurnStartHook: () => void): void {
this._onTurnStart = normalizeBlank(onTurnStartHook);
}
@ -156,7 +147,7 @@ export class NgZone {
*
* Setting the hook overrides any previously set hook.
*/
overrideOnTurnDone(onTurnDoneHook: Function): void {
overrideOnTurnDone(onTurnDoneHook: () => void): void {
this._onTurnDone = normalizeBlank(onTurnDoneHook);
}
@ -171,7 +162,7 @@ export class NgZone {
*
* Setting the hook overrides any previously set hook.
*/
overrideOnEventDone(onEventDoneFn: Function, opt_waitForAsync: boolean = false): void {
overrideOnEventDone(onEventDoneFn: () => void, opt_waitForAsync: boolean = false): void {
var normalizedOnEventDone = normalizeBlank(onEventDoneFn);
if (opt_waitForAsync) {
this._onEventDone = () => {
@ -242,7 +233,7 @@ export class NgZone {
var errorHandling;
if (enableLongStackTrace) {
errorHandling = StringMapWrapper.merge(<any>Zone.longStackTraceZone,
errorHandling = StringMapWrapper.merge(Zone.longStackTraceZone,
{onError: function(e) { ngZone._onError(this, e); }});
} else {
errorHandling = {onError: function(e) { ngZone._onError(this, e); }};

View File

@ -21,7 +21,7 @@
"commit": "be0b6b394f77a59e192ad7cfec18078706e44db5"
},
"zone/zone.d.ts": {
"commit": "055b3172e8eb374a75826710c4d08677872620d3"
"commit": "31e7317c9a0793857109236ef7c7f223305a8aa9"
},
"angular-protractor/angular-protractor.d.ts": {
"commit": "4207593c012565a7ea800ed861ffbe5011e7a501"