1.0.0 • Published 7 years ago

promise-domain-monkeypatch v1.0.0

Weekly downloads
17
License
-
Repository
github
Last release
7 years ago

promise-domain-monkeypatch

Don't break domain usage in an es6 Promise chain

This issue sheds a bit more detail, but basically the ES6 promise implementation in Node doesn't carry through the domain context (if there is one).

This is a module to monkeypatch to fix this.

More are examples are in the tests.

Useage

require('promise-domain-monkeypatch');

This will apply the patch.

You can unpatch by doing the following:

let PromisePatcher = require('promise-domain-monkeypatch');
PromisePatcher.unpatch();

Not applying the patch immediately

let PromisePatcher = require('promise-domain-monkeypatch/patcher');

...some code...

PromisePatcher.patch();

...some code...

PromisePatcher.unpatch();

Tests

mocha --recursive