JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 134305
  • Score
    100M100P100Q165800F

A much higher accuracy timer object that makes use of the node.js hrtime function call.

Package Exports

  • nanotimer

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 (nanotimer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

nanotimer

A much higher accuracy timer object that makes use of the node.js hrtime function call.

The nanotimer recreates the internal javascript timing functions with higher resolution.

var nanoTimer = require('nanotimer');

.setTimeout(task, timeout, callback)

  • timeout, specified in nanoseconds.

Use:

var task = function () {
    console.log('My task runs!');
};

nanoTimer.setTimeout(task, 1000000000, function(err) {
    if(err) {
        //error
    }
});

.setInterval(task, interval, callback)

  • interval, specified in nanoseconds.

Use:

var task = function () {
    console.log('My task runs!');
};

nanoTimer.setInterval(task, 1000000000, function(err) {
    if(err) {
        //error
    }
});

.time(task, callback)

Use:

var task = function () {
    console.log('My task runs!');
};

var runtime = nanoTimer.time(task);