promise-domain-monkeypatch

Don't break domain usage in an es6 Promise chain

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
promise-domain-monkeypatch
001.0.05 years ago5 years agoMinified + gzip package size for promise-domain-monkeypatch in KB

Readme

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