Package Exports
- downtime
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (downtime) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
downtime
Do background work during browser idle time.
const downtime = require("downtime")API
downtime.do(callback)
- Schedule
callbackto run during next idle period - Return an
idfor cancellation purposes - Callback is invoked with an
IdleDeadlineobject
downtime.do(function(deadline) {
// Do background work
})downtime.dont(id)
- Cancel callback represented by
id
var id = downtime.do(doBackgroundWork)
downtime.dont(id)Notes
- Downtime uses
requestIdleCallbackandcancelIdleCallbackwhere available - Fallback technique is based on this gist
- For best performance, avoid DOM manipulation during idle time
Compatibility
- Native: caniuse: requestIdleCallback
- Fallback: any JavaScript environment