blocked

WebJar for blocked

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

blocked
Last Version

Last Version

1.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

blocked
WebJar for blocked
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/tj/node-blocked

Download blocked

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/blocked/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>blocked</artifactId>
    <version>1.2.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/blocked/
implementation 'org.webjars.npm:blocked:1.2.1'
// https://jarcasting.com/artifacts/org.webjars.npm/blocked/
implementation ("org.webjars.npm:blocked:1.2.1")
'org.webjars.npm:blocked:jar:1.2.1'
<dependency org="org.webjars.npm" name="blocked" rev="1.2.1">
  <artifact name="blocked" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='blocked', version='1.2.1')
)
libraryDependencies += "org.webjars.npm" % "blocked" % "1.2.1"
[org.webjars.npm/blocked "1.2.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

blocked

Check if a node event loop is blocked.

If You're running Node.js 8+ you can get a stacktrace pointing to the blocking function using very similar blocked-at package.

Installation

$ npm install blocked

Description

The blocked() function reports every value over the configured threshold (defaulted to 10ms). You can then do whatever you want with that value, graph it, log it, alert, etc.

The process won't be kept open through this.

Params and return value

var timer = blocked(fn, options);
  • fn: The callback function to execute when the event loop is blocked. Will send in the amount of time in ms that the event loop was blocked.
  • options: Optional. Options object to configure the behaviour.
    • threshold determines the amount of ms used to determine if the function callback should be executed; useful to speed up tests.
    • interval determines the frequency with which the event loop is checked in ms.
blocked(function(ms) {
    console.log("Blocked");
}, {threshold:1, interval: 1000});

Returns: A reference to the timer. Useful for clearing the timer.

var timer = blocked(function(ms) {
                console.log("Blocked");
            });
clearInterval(timer);

License

MIT

Versions

Version
1.2.1