requestIdle
WARNING: this is not a polyfill for requestIdleCallback
, if you are looking for such thing, try this one.
Allocate time for you task to run!
Install
npm install request-idle --save
Usage
requestIdle(Number:duration, Function:task)
Allocate time with duration
parameter, and run given task, eg:
; ;
An idle
object is passed to task, thus you can release the idle by idle.end()
before given duration:
; ;
requestIdle(Function:task)
If first parameter is passed as function, you'll get an idle that is almost endless. So don't forget to end up the idle when you don't need it any more.
;
idle#end()
Release current idle.
idle#add(Number:ms)
Extend current idle duration.
idle#remain
Get current idle time remaining.
License
MIT.