obstructed

Checks if the main thread is busy, executing a callback whenever it happens.

Stats

StarsIssuesVersionUpdatedCreatedSize
obstructed
611.0.54 years ago5 years agoMinified + gzip package size for obstructed in KB

Readme

obstructed

npm version codecov

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


caiogondim.com  ·  GitHub @caiogondim  ·  Twitter @caio_gondim

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.