Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var assert = require('assert');
console.log('+');
// comment out this line to get what I expect:
setImmediate(function () { console.log('!'); });
var counter = 1;
var current;
var id = process.addAsyncListener(
function listener() { return counter++; },
{
before : function (_, domain) { current = domain; },
after : function () { current = null; }
}
);
setImmediate(function () { assert.equal(current, 1); });
// uncomment this line to get what I expect:
// process.removeAsyncListener(id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.