timestop
1.0.0
وقفة setTimeout إذا لزم الأمر.
قد يكون من المفيد في مثل هذا الموقف أن تتوقف مؤقتًا "settimeout" لمنع بعض المهزمين الناتجة عن "settimeout" أثناء التحقق من نقاط التوقف في وقت تصحيح الأخطاء.
// Require it in Node.js or include it with <script src='timestop.js'> in
// browsers before any 'setTimeout' you want to be affected.
// in Node.js (it will attach 'timestop' object to window if in browsers)
var timestop = require('timestop')
var start = new Date;
setTimeout(function() {
console.log(new Date - start) // should be about 1500
}, 1000)
// all the affected 'setTimeout' will be paused
timestop.pause()
// .. assume 500ms elapsed.
// all the affected 'setTimeout' will be resumed.
timestop.resume()