timeout.js
337 Bytes
var slice = require('../array/slice');
/**
* Delays the call of a function within a given context.
*/
function timeout(fn, millis, context){
var args = slice(arguments, 3);
return setTimeout(function() {
fn.apply(context, args);
}, millis);
}
module.exports = timeout;