From b923a5aaf013ac84c566f27ba6b5843211981c7a Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Mon, 9 Nov 2015 14:46:11 -0800 Subject: [PATCH] add typings for zone.js --- zone.js/zone.js-tests.ts | 11 +++++++++++ zone.js/zone.js.d.ts | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 zone.js/zone.js-tests.ts create mode 100644 zone.js/zone.js.d.ts diff --git a/zone.js/zone.js-tests.ts b/zone.js/zone.js-tests.ts new file mode 100644 index 000000000..e0a4df3b6 --- /dev/null +++ b/zone.js/zone.js-tests.ts @@ -0,0 +1,11 @@ +/// + +declare var zone: Zone; + +zone.fork().fork({ + beforeTask: function () { + console.log('from beforeTask'); + } +}).run(function () { + console.log('from main'); +}); diff --git a/zone.js/zone.js.d.ts b/zone.js/zone.js.d.ts new file mode 100644 index 000000000..a34e1f8f5 --- /dev/null +++ b/zone.js/zone.js.d.ts @@ -0,0 +1,21 @@ +// Type definitions for Zone.js +// Project: https://github.com/angular/zone.js +// Definitions by: angular team +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare class Zone { + constructor(parentZone: Zone, data: any); + + fork(locals?: {[key: string]: any}): Zone; + bind(fn: Function, skipEnqueue?: boolean): void; + bindOnce(fn: Function): any; + run(fn: Function, applyTo?: any, applyWith?: any): void; + isRootZone(): boolean; + + static bindPromiseFn Promise>(fn: T): T; + + static longStackTraceZone: {[key: string]: any}; +} +