Skip to content

Commit

Permalink
Merge pull request #1 from captureplay/master
Browse files Browse the repository at this point in the history
Update index.js
  • Loading branch information
emerleite committed Dec 5, 2014
2 parents 4c1e888 + ae99211 commit 2544a9a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion index.js
@@ -1 +1 @@
module.exports = require('./lib/stopwatcher');
module.exports = require('./lib/stopwatch');
8 changes: 3 additions & 5 deletions lib/stopwatch.js
@@ -1,4 +1,3 @@
var util = require('util');
var EventEmitter = require('events').EventEmitter;
var stopwatches = {};

Expand All @@ -11,7 +10,7 @@ function Stopwatch(id, options) {
this.timer = null;
}

util.inherits(Stopwatch, EventEmitter);
Stopwatch.prototype.__proto__ = EventEmitter.prototype;

Stopwatch.prototype.stop = function() {
clearInterval(this.timer);
Expand All @@ -22,12 +21,11 @@ Stopwatch.prototype.start = function() {
if (this.started()) { return false; }

var self = this;
var currentSeconds = self.seconds;

self.timer = setInterval(function () {
self.emit('tick', currentSeconds);
self.emit('tick', self.seconds);

if (--currentSeconds < 0) {
if (--self.seconds < 0) {
self.stop();
self.emit('end');
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -17,7 +17,7 @@
},
"dependencies": {},
"devDependencies": {
"mocha" : "0.3.6",
"should" : "0.3.2"
"mocha" : "1.15.1",
"should" : "2.1.1"
}
}

0 comments on commit 2544a9a

Please sign in to comment.