Timer

  1. npm install moment-timer

This is a Moment.js plugin that allows the use of timers, which offer much more control than the native JavaScript timers.It's basically a rewrite of JavaScripts own setInterval and setTimeout.

For example,

  1. var timer = moment.duration(5, "seconds").timer({loop: true}, function() {
  2. // Callback
  3. });

The repository is located at github.com/SeverinDK/moment-timer.