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
##Install 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
elapsed1.set()###get() Returns the number of seconds elapsed. E.g. 13.947172826, (almost 14 seconds.)
console.log( elapsed1.get() )##Examples Time how long it takes for a callback to be called:
var Elapsed() = require('ns-elapsed')
var elapsed = new Elapsed()
elapsed.set()
setTimeout(function() {
console.log( elapsed.get() )
}, 1000)Time how long it takes for a synchronous function to execute:
var elapsed = require('ns-elapsed')()
//synchronous code here
console.log( elapsed.get() )##License