0.14.4 • Published 2 months ago

zone.js v0.14.4

Weekly downloads
1,986,297
License
MIT
Repository
github
Last release
2 months ago

Zone.js

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.

BREAKING CHANGES since Zone.js v0.11.1

Prior to v0.11.1, Zone.js provided two distribution bundle formats in the dist folder. They were (1) ES5 bundle distributed as zone.js and (2) ES2015 bundle distributed as zone-evergreen.js. Both of these bundles were in UMD format, and are used for Angular's differential-loading mechanism.

Starting with v0.11.1, Zone.js follows the Angular Package Format. Therefor the new Zone.js file layout is:

  • bundles: ES5 bundle in UMD format.
  • fesm2015: ES5 bundle in ESM format.
  • dist: ES5 bundle in UMD format. This directory is present to keep backward compatibility.

If you are using Angular CLI, the polyfills.ts file will contain:

import 'zone.js/dist/zone';

Starting with Zone.js v0.11.1+ the import changes to:

import 'zone.js';

Prior to v0.11.1 the import would load the ES5 bundle in UMD format from dist/zone.js. Starting with v0.11.1 the import loads the ES2015 bundle in ESM format instead.

This is a breaking change for legacy browsers such as IE11.

For backwards compatibility zone.js continues to distribute the same bundles under dist. To restore the old behavior import from the dist directory instead like so:

import 'zone.js/dist/zone';

For details, please refer the changelog and the PR.

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.

Bundles

Starting with v0.11.0, zone.js uses Angular Package Format for bundle distribution. (For backwards compatibility, all bundles can still be accessed from dist folder.)

BundleSummary
zone.jsThe default bundle. Contains the most used APIs such as setTimeout/Promise/EventTarget..., it also supports differential loading by importing this bundle using import zone.js. In legacy browsers it includes some additional patches such as registerElement and EventTarget like APIs.
zone-testing.jsThe bundle for zone testing support of jasmine / mocha / jest. Also includes test utility functions async / fakeAsync / sync.
zone-node.jsThe NodeJS support bundle.
zone-mix.jsA mixed bundle which supports both browser and NodeJS. Useful for mixed environment such as Electron.
zone-externs.jsthe API definitions for closure compiler.

Additional optional patches not included in the zone.js bundles which extend functionality. The additional bundles can be found under zone.js/plugins folder. To use these bundles, add the following code after importing zone.js bundle.

import 'zone.js';
// For example, import canvas patch
import 'zone.js/plugins/zone-patch-canvas';
PatchSummary
webapis-media-query.jspatch for MediaQuery APIs
webapis-notification.jspatch for Notification APIs
webapis-rtc-peer-connection.jspatch for RTCPeerConnection APIs
webapis-shadydom.jspatch for Shady DOM APIs
zone-bluebird.jspatch for Bluebird APIs
zone-error.jspatch for Error Global Object, supports adding zone information to stack frame, and also removing unrelated stack frames from zone.js internally
zone-patch-canvas.jspatch for Canvas API
zone-patch-cordova.jspatch for Cordova API
zone-patch-electron.jspatch for Electron API
zone-patch-fetch.jspatch for Fetch API
zone-patch-jsonp.jshelper utility for jsonp API
zone-patch-resize-observer.jspatch for ResizeObserver API
zone-patch-rxjs.jspatch for rxjs API
zone-patch-rxjs-fake-async.jspatch for rxjs fakeasync test
zone-patch-socket-io.jspatch for socket-io
zone-patch-user-media.jspatch for UserMedia API
zone-patch-message-port.jspatch for MessagePort API

License

MIT

codelyzer@cargos/cargongwaafipay_adminportal.pkgwipo-ui-angular-appwopermcpdummybdummybdummybdummyddummyd@arunkeshavareddy/dc-common@ljmarquezge2y/worldpay-spartacus@ironsource/fusion-ui@eui/deps-base@hyperblob/magic-table@hug-sct/portail-pro-libs@igtb-digital/k4-frb-ui-escrow-workspace@hnct/uicommonangular4-starter-packbrcap-view-componentsv14c8osdkangularchamsswitchsdkangular-package8@ekaruztech/angular2httpmodulecpf-and-cnpj-fieldciti-angularebcont-galaxy@bhargavt17/media-weaver-hub@c8y/appsauthentication-angularapp-fast-marqueeaz-widget-base-card@casejs/clientleutsi-strappcs-dmcs@em100/common-library@piratuks/tslint-config-code-style@hoohsu/my-workspaceng-mf-libsmart.connectors@lustruj/lfl@eb-components/toggle-treesingle-spa-def-appsingle-spa-qspace-appspm-acr-spa-uisdi-test-datahubfx-cms-ui@amn31/ma-ng-data-gridng-tongbao-coregdwebgdwebeditplatangular-udemyangular-tetaop-navigation@muros-ct/angular-plotly@dineshghule321/nebularsmart-accounts-experiencecollaborate-space-for-webkles-libnpm-library-vishwamenelaos-componentaccelerator-experiencearitha-chatbot@corneliu.tirbu/my-workspaceworkspace-plusminus-decoratorsteste-angularangularmodulemktestbbmy-workspace1formbuilder11729ts-shared-libseverino-validators-ng2sidebar-triawos-payments-ngxstyle-gemednewshore-core-ui@jatinderkumar/ng2-input-autocomplete@hivecloud/angular-ui-libadm-ui-kitlocal-aprsng-selectize-v2simplenpmpakagestudying-lib@stratosui/core@asadsahi/ng-componentsbasic-dialogdelon-hhfront-core-libgrafword_oktalib-doc-componentsldp-alert-dialoglib-upe-apiupe-apineo-ui-template@rebase-team/lib-upe-api@maicongodinho1/common@dsystem/design-system@saadriazkhan/scania-banner@geisiaa/design-systemng-zoesmartub-servicengx-aton-baseweb-components-reeimage-upload-btn
0.14.4

2 months ago

0.14.3

4 months ago

0.14.2

6 months ago

0.14.1

6 months ago

0.13.1

11 months ago

0.13.2

8 months ago

0.13.3

8 months ago

0.14.0

7 months ago

0.13.0

1 year ago

0.12.0

1 year ago

0.11.8

2 years ago

0.11.6

2 years ago

0.11.7

2 years ago

0.11.5

2 years ago

0.11.4

3 years ago

0.11.3

3 years ago

0.11.2

4 years ago

0.11.1

4 years ago

0.11.0

4 years ago

0.10.3

4 years ago

0.10.2

5 years ago

0.10.1

5 years ago

0.10.0

5 years ago

0.9.1

5 years ago

0.9.0

5 years ago

0.8.29

5 years ago

0.8.28

5 years ago

0.8.27

5 years ago

0.8.26

6 years ago

0.8.25

6 years ago

0.8.24

6 years ago

0.8.23

6 years ago

0.8.22

6 years ago

0.8.21

6 years ago

0.8.20

6 years ago

0.8.19

6 years ago

0.8.18

7 years ago

0.8.17

7 years ago

0.8.16

7 years ago

0.8.14

7 years ago

0.8.13

7 years ago

0.8.12

7 years ago

0.8.11

7 years ago

0.8.10

7 years ago

0.8.9

7 years ago

0.8.8

7 years ago

0.8.7

7 years ago

0.8.6

7 years ago

0.8.5

7 years ago

0.8.4

7 years ago

0.8.3

7 years ago

0.8.2

7 years ago

0.8.1

7 years ago

0.8.0

7 years ago

0.7.8

7 years ago

0.7.7

7 years ago

0.7.6

7 years ago

0.7.5

7 years ago

0.7.4

7 years ago

0.7.3

7 years ago

0.7.2

7 years ago

0.7.1

7 years ago

0.7.0

7 years ago

0.6.26

8 years ago

0.6.25

8 years ago

0.6.24

8 years ago

0.6.23

8 years ago

0.6.22

8 years ago

0.6.21

8 years ago

0.6.20

8 years ago

0.6.19

8 years ago

0.6.18

8 years ago

0.6.17

8 years ago

0.6.16

8 years ago

0.6.15

8 years ago

0.6.14

8 years ago

0.6.13

8 years ago

0.6.12

8 years ago

0.6.11

8 years ago

0.6.10

8 years ago

0.6.9

8 years ago

0.6.8

8 years ago

0.6.6

8 years ago

0.6.5

8 years ago

0.6.4

8 years ago

0.6.3

8 years ago

0.6.2

8 years ago

0.6.1

8 years ago

0.6.0

8 years ago

0.5.15

8 years ago

0.5.14

8 years ago

0.5.13

8 years ago

0.5.12

8 years ago

0.5.11

8 years ago

0.5.10

8 years ago

0.5.9

8 years ago

0.5.8

9 years ago

0.5.7

9 years ago

0.5.6

9 years ago

0.5.5

9 years ago

0.5.4

9 years ago

0.5.3

9 years ago

0.5.2

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago

0.4.4

9 years ago

0.4.3

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.0

10 years ago

0.2.4

10 years ago

0.2.2

10 years ago

0.2.3

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago