From 05a316a6a70dadb821661d3fcfde7cc314297ef6 Mon Sep 17 00:00:00 2001 From: Whitney Young Date: Mon, 16 Jan 2017 12:13:08 -0800 Subject: [PATCH] Match tick callback to Node's logic --- index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 5166550..cf78736 100644 --- a/index.js +++ b/index.js @@ -62,14 +62,16 @@ }); module.exports.runLoopOnce = function(){ - process._tickDomainCallback(); + var tick = process.domain + ? process._tickDomainCallback + : process._tickCallback; + tick(); binding.run(); }; module.exports.loopWhile = function(pred){ while(pred()){ - process._tickDomainCallback(); - if(pred()) binding.run(); + module.exports.runLoopOnce(); } };