Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

howmuchtime

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

howmuchtime

Tells how much time (in µs) a callback has taken to be called

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

Goal

Now how much time takes a callback to be called.

Usage

Instead of passing a callback, use howmuchtime(callback) to log how much time was taken to call the callback, e.g.:

var howmuchtime = require('howmuchtime');
setTimeout(howmuchtime(function(){console.log('hello!')}),20);

will result in :

The callback call was done in 29437 µs

hello!

You can optionnaly pass a second argument which is a "timeHandler" function, which will be called before the callback, with 3 arguments:

  • difference (in µs)
  • start time (in µs)
  • end time (in µs)

FAQs

Package last updated on 16 Aug 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts