Skip to content

Instantly share code, notes, and snippets.

@creationix
Last active December 30, 2015 04:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save creationix/7776192 to your computer and use it in GitHub Desktop.
Save creationix/7776192 to your computer and use it in GitHub Desktop.
// We can't console.log inside of the event handlers since that triggers a new
// event source. This is safe to call though, since it sets a global ignore flag.
var ignore = false;
function print(msg) {
ignore = true;
console.log(msg);
ignore = false;
}
process.addAsyncListener(function () {
if (ignore) return;
// ...
}, {
before: function (context, storage) {
if (ignore || !storage) return;
// ...
},
after: function (context, storage) {
if (ignore || !storage) return;
// ...
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment