minimal Zone implementation for Node
This implementation is based on the experimental AsyncWrap API, but it seems to work fine.
Work with any asynchronous tasks (IO, timers, promises, external modules, …).
Install
Installation of the npm package:
> npm install --save node-zone
Usage
// a zone has a name, a parent, and dataconsole // create a new child zoneconst myZone = current console // run some code in itmyZone console // "<root>"
Note: There is an issue with Node cluster module, which prevents handlers created in workers to properly access the current zone,
Zone.current
will be the root zone instead.
Development
# Install dependencies
> yarn
# Run the tests
> yarn test
# Continuously compile
> yarn dev
# Continuously run the tests
> yarn dev-test
# Build for production (automatically called by npm install)
> yarn build
Contributions
Contributions are very welcomed, either on the documentation or on the code.
You may:
- report any issue you've encountered;
- fork and create a pull request.
License
ISC © Julien Fontanet