neo-timer

0.2.0 • Public • Published

neo-timer

neo-timer can be used as a timer or stopwatch.

The timer is selected automatically by your environment.

functions

init

start

diff

lap

result

example

 
'use strict';
 
var Timer = require('../');
var timer = new Timer({
  MAX_LAP_LENGTH: 100
});
 
var count = 0;
var times = 100;
 
timer.init().start();
 
var iter = function() {
  setTimeout(function() {
    clearTimeout(iter);
    timer.lap();
    if (count === times) {
      console.log(timer.result());
    } else {
      iter();
    }
  }, Math.random() * 10 * ++count);
};
 
iter();
 

graph

Readme

Keywords

none

Package Sidebar

Install

npm i neo-timer

Weekly Downloads

15

Version

0.2.0

License

MIT

Last publish

Collaborators

  • suguru03