Implements Zones for JavaScript
TypeScript JavaScript HTML Other
mitchellwills and mhevery Ensure FakeAsyncTestZoneSpec tick always doTick (#1099)
In the case where there is pending work in the scheduler queue, but the duration
of the tick did not causes it to run the doTick callback would not be called (or
would not be called with intervals summing to the total time ellapsed).
Latest commit 9c96904 Jul 27, 2018
Permalink
Failed to load latest commit information.
dist chare: release v0.8.26 Apr 8, 2018
doc chore: Fix the URL to zone.js.d.ts (#922) Dec 27, 2017
example feat(eventListener): fix #798, improve EventTarget.addEventListener p… Jun 30, 2017
lib Ensure FakeAsyncTestZoneSpec tick always doTick (#1099) Jul 27, 2018
scripts chore: refactor closure build (#844) Jul 20, 2017
test Ensure FakeAsyncTestZoneSpec tick always doTick (#1099) Jul 27, 2018
.clang-format build: add a clang-format task Oct 4, 2016
.editorconfig chore: add support for .editorconfig Apr 21, 2017
.gitignore chore: update .gitignore with build-esm Sep 10, 2016
.travis.yml feat(error): fix #975, can config how to load blacklist zone stack fr… Jun 24, 2018
CHANGELOG.md chare: release v0.8.26 Apr 8, 2018
DEVELOPER.md feat(build): use yarn instead of npm (#1025) Feb 27, 2018
LICENSE style(License): update copyright year (#986) Feb 8, 2018
LICENSE.wrapped chore(everything): Major Zone Rewrite/Reimplementation Feb 29, 2016
MODULE.md feat(error): fix #975, can config how to load blacklist zone stack fr… Jun 24, 2018
NON-STANDARD-APIS.md feat(patch): fix #1011, patch ResizeObserver (#1012) Feb 12, 2018
README.md doc(sample): add samples to stackblitz (#1059) Jun 18, 2018
SAMPLE.md doc(sample): add samples to stackblitz (#1059) Jun 18, 2018
STANDARD-APIS.md fix(event): blackListedEvents also apply on addEventListener (#968) Dec 27, 2017
check-file-size.js fix(core): add file check script in travis build Jan 10, 2018
file-size-limit.json fix(bluebird): fix #1112, bluebird chained callback should return a … Jul 27, 2018
gulpfile.js feat(error): fix #975, can config how to load blacklist zone stack fr… Jun 24, 2018
karma-base.conf.js feat(error): fix #975, can config how to load blacklist zone stack fr… Jun 24, 2018
karma-build-jasmine-phantomjs.conf.js fix(websocket): fix #824, patch websocket onproperties correctly in … Jul 12, 2017
karma-build-jasmine.conf.js fix: Run tests on both the build as well as the dist folder (#514) Dec 18, 2016
karma-build-mocha.conf.js fix: Run tests on both the build as well as the dist folder (#514) Dec 18, 2016
karma-build-sauce-mocha.conf.js fix: Run tests on both the build as well as the dist folder (#514) Dec 18, 2016
karma-build-sauce-selenium3-mocha.conf.js fix(test): fix mocha compatible issue (#1028) Mar 14, 2018
karma-build.conf.js feat(error): fix #975, can config how to load blacklist zone stack fr… Jun 24, 2018
karma-dist-jasmine.conf.js fix: Run tests on both the build as well as the dist folder (#514) Dec 18, 2016
karma-dist-mocha.conf.js fix(test): karma-dist should test bundle under dist (#1049) Jun 18, 2018
karma-dist-sauce-jasmine.conf.js fix(promise): can set native promise after loading zone.js (#899) Sep 15, 2017
karma-dist-sauce-jasmine3.conf.js fix(jasmine): fix #1015, make jasmine patch compatible to jasmine 3.x ( Feb 17, 2018
karma-dist-sauce-selenium3-jasmine.conf.js ci(SauceLabs): refresh browsers list (#716) Apr 10, 2017
karma-dist.conf.js fix(test): karma-dist should test bundle under dist (#1049) Jun 18, 2018
package.json feat(error): fix #975, can config how to load blacklist zone stack fr… Jun 24, 2018
presentation.png readme: add ng-conf presentation Jan 27, 2014
promise-adapter.js feat(promise): fix #621, add unhandledRejection handler and ignore co… Feb 8, 2017
promise.finally.spec.js feat(promise): support Promise.prototype.finally (#1005) Feb 10, 2018
sauce-selenium3.conf.js feat(error): fix #975, can config how to load blacklist zone stack fr… Jun 24, 2018
sauce.conf.js feat(error): fix #975, can config how to load blacklist zone stack fr… Jun 24, 2018
simple-server.js feat(saucelab): integrate saucelab webdriver test. (#819) Jul 6, 2017
tsconfig-esm-node.json fix(tsc): tsconfig.json strict:true Jun 18, 2018
tsconfig-esm.json fix(tsc): tsconfig.json strict:true Jun 18, 2018
tsconfig-node.json fix(tsc): tsconfig.json strict:true Jun 18, 2018
tsconfig.json fix(tsc): tsconfig.json strict:true Jun 18, 2018
tslint.json build: enforce no var keyword Dec 28, 2016
webpack.config.js chore(everything): Major Zone Rewrite/Reimplementation Feb 29, 2016
yarn.lock feat(error): fix #975, can config how to load blacklist zone stack fr… Jun 24, 2018

README.md

Zone.js

Build Status CDNJS

Implements Zones for JavaScript, inspired by Dart.

If you're using zone.js via unpkg (i.e. using https://unpkg.com/zone.js) and you're using any of the following libraries, make sure you import them first

  • 'newrelic' as it patches global.Promise before zone.js does
  • 'async-listener' as it patches global.setTimeout, global.setInterval before zone.js does
  • 'continuation-local-storage' as it uses async-listener

NEW Zone.js POST-v0.6.0

See the new API here.

Read up on Zone Primer.

What's a Zone?

A Zone is an execution context that persists across async tasks. You can think of it as thread-local storage for JavaScript VMs.

See this video from ng-conf 2014 for a detailed explanation:

screenshot of the zone.js presentation and ng-conf 2014

See also

Standard API support

zone.js patched most standard web APIs (such as DOM events, XMLHttpRequest, ...) and nodejs APIs (EventEmitter, fs, ...), for more details, please see STANDARD-APIS.md.

Nonstandard API support

We are adding support to some nonstandard APIs, such as MediaQuery and Notification. Please see NON-STANDARD-APIS.md for more details.

Examples

You can find some samples to describe how to use zone.js in SAMPLE.md.

Modules

zone.js patches the async APIs described above, but those patches will have some overhead. Starting from zone.js v0.8.9, you can choose which web API module you want to patch. For more details, please see MODULE.md.

Promise A+ test passed

Promises/A+ 1.1 compliant

License

MIT