Add a sleep function (useful for introducing latency in manual debugging).

This commit is contained in:
David Glasser
2012-11-19 20:34:48 -08:00
parent dcdd6da47f
commit f4573dbb1b

View File

@@ -141,4 +141,15 @@ _.extend(Meteor._SynchronousQueue.prototype, {
}
});
// Sleep. Mostly used for debugging (eg, inserting latency into server
// methods).
Meteor._sleepForMs = function (ms) {
var fiber = Fiber.current;
setTimeout(function() {
fiber.run();
}, ms);
Fiber.yield();
};
})();