/async-zone

An implementation of TC39 Zone

Primary LanguageJavaScript

async-zone

WIP!

A TC39 Zone implementation using async_wrap.

Zone is currently a state-0 proprosal, and very helpful to deal with:

  • ThreadLocal-like senarios for async calls
  • tracing and capturing call stack
  • uncaught exceptions and unhandled rejections

IDL for Zone

class Zone {
  constructor({ name, parent });

  name;
  get parent();

  fork({ name });
  run(callback);
  wrap(callback);

  static get current();
}

Issues

  • The callback of net.createServer will be run in root zone, if not wrapped. Child zones will inherit from zones from parent handle if possible.