Delay the call of a function in a given context.
Based on the excellent mout's timeout implementation, offered to you as a tiny module.
Install with npm
npm i set-timeout --save
Acts as a wrapper for setTimeout
. Calls the given fn
within the specified context
, after the given delay in ms
(milliseconds).
The return value can be used to clear the timeout using clearTimeout
.
var timeout = require('set-timeout');
var id = timeout(doStuff, 300, this);
clearTimeout(id);
npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright (c) 2014 Jon Schlinkert
Released under the MIT license
This file was generated by verb on December 12, 2014. To update, run npm i -g verb && verb
.