JSPM

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

Simple, nanosecond resolution 'stopwatch' for nodeJS. Ideal for benchmark times.

Package Exports

  • ns-elapsed

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

Readme

ns-elapsed

Build Status Github Repository

##Install

Install with NPM

npm install ns-elapsed

##Require To require the constructor do:

var Elapsed = require('ns-elapsed')
var elapsed = new Elapsed()
var elapsed2 = new Elapsed()

If you only want one timer, you might as well construct it right away.

var elapsed = require('ns-elapsed')() //constructed

##Methods ###set()

Does not return anything.

Automatically called when constructed.

elapsed.set()

###get()

Returns the number of seconds elapsed. E.g. 13.947172826, (almost 14 seconds.)

console.log( elapsed1.get() ) //should log something like '13.947172826'

##Examples

Asynchronous example

var Elapsed() = require('ns-elapsed')
var elapsed = new Elapsed()
elapsed.set() //This is superfluous because 'set()' is automatically called when 'elapsed' was constructed.
setTimeout(function() { //Asynchronous code here
    console.log( elapsed.get() )
}, 1000)

Synchronous example:

var elapsed = require('ns-elapsed')()
//Synchronous code here
console.log( elapsed.get() )

##License

MIT