obstructed
v1.0.5
Published
Checks if the main thread is busy, executing a callback whenever it happens.
Downloads
42
Readme
obstructed
obstructed.js checks if the main thread is busy, executing a callback whenever it happens. It runs on the browser and on the server. The API is compatible with blocked.
Installation
npm install --save obstructed
Usage
const timer = obstructed(function(ms) {
console.log('Main thread was blocked for about ' + ms + 'ms')
})
Use the returned timer and clearInterval
on it to stop the lib on checking if
the main thread is blocked.
// Uses the previously defined `timer`
clearInterval(timer)
Credits
- Icon by Edward Boatman
- blocked
caiogondim.com · GitHub @caiogondim · Twitter @caio_gondim