From c156b5a540fc9910942e2a9327e7f4191bfba141 Mon Sep 17 00:00:00 2001 From: Shaun Date: Sat, 3 Oct 2015 17:01:33 +0800 Subject: [PATCH] Updated stopwatch.js Comment: http://robdodson.me/building-a-countdown-timer-with-socket-dot-io-pt-2/#comment-1289598915 Since Underscore.js 1.5.0, _.bindAll requires that you pass in the object and the names of the methods to bind on the object. In previous versions, like yours I'm guessing, there method names were optional. _.bindAll(this, 'start', 'stop', 'reset', 'onTick', 'formatTime', 'getTime'); will fix this problem! --- models/stopwatch.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/stopwatch.js b/models/stopwatch.js index 29ace51..d0be3a9 100644 --- a/models/stopwatch.js +++ b/models/stopwatch.js @@ -20,7 +20,7 @@ function Stopwatch() { // Use Underscore to bind all of our methods // to the proper context - _.bindAll(this); + _.bindAll(this, 'start', 'stop', 'reset', 'onTick', 'formatTime', 'getTime'); }; // --------------------------------------------- @@ -102,4 +102,4 @@ Stopwatch.prototype.getTime = function() { // --------------------------------------------- // Export // --------------------------------------------- -module.exports = Stopwatch; \ No newline at end of file +module.exports = Stopwatch;