Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1 from apeace/master

Fix starting and stopping
  • Loading branch information...
commit a4398aeca33695e46af011ece79392a5c9c6cec3 2 parents d42243b + 52b4617
Cam Pedersen authored
Showing with 7 additions and 6 deletions.
  1. +7 −6 lib/main.js
13 lib/main.js
View
@@ -11,15 +11,16 @@ var ekg = new events.EventEmitter(),
module.exports = ekg;
ekg.start = function(interval){
- ekg.update(function(){
- interval = interval || 100;
- var cycle = setInterval(ekg.run, interval);
- return ekg;
- });
+ if (!cycle) {
+ ekg.update(function(){
+ interval = interval || 100;
+ cycle = setInterval(ekg.run, interval);
+ });
+ }
}
ekg.stop = function(){
- clearInterval(cycle);
+ if (cycle) clearInterval(cycle);
}
ekg.update = function(cb){
Please sign in to comment.
Something went wrong with that request. Please try again.