From ec9b44427cd1b565f2c4fefb80b4360aa5eaf6e3 Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 3 Jul 2014 21:16:47 +0200 Subject: [PATCH] renamed _timer to timer --- js/uhr.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/js/uhr.js b/js/uhr.js index 4ede129..aa823be 100644 --- a/js/uhr.js +++ b/js/uhr.js @@ -58,7 +58,7 @@ along with this program. If not, see . var start = function start() { if (!isOn(this)) { var uhr = this; - this._timer = window.setInterval(function uhrTimer() { + this.timer = window.setInterval(function uhrTimer() { uhr.options.time = new Date(); update(uhr); }, 1000); @@ -68,8 +68,8 @@ along with this program. If not, see . }; var stop = function stop() { if (isOn(this)) { - window.clearInterval(this._timer); - this._timer = null; + window.clearInterval(this.timer); + this.timer = null; update(this); setCookie(this, 'uhr-status', 'off'); } @@ -107,8 +107,8 @@ along with this program. If not, see . if (time === null) { this.options.time = new Date(); } else { - if (this._timer !== null) { - window.clearInterval(this._timer); + if (this.timer !== null) { + window.clearInterval(this.timer); } this.options.time = time; } @@ -118,6 +118,8 @@ along with this program. If not, see . // private interface methods var create = function create() { this._id = uhrGlobals.id++; + this.timer = null; + this._currentMinute = -1; var userTime = this.options.time; if (this.options.time === undefined) { this.options.time = new Date(); @@ -265,7 +267,7 @@ along with this program. If not, see . // business logic var isOn = function isOn(uhr) { - return uhr._timer !== null; + return uhr.timer !== null; }; var update = function update(uhr) { if (isOn(uhr)) { @@ -349,11 +351,7 @@ along with this program. If not, see . "theme": setTheme, "time": setTime, // constructor method - "_create": create, - // private variables - "_id": -1, - "_timer": null, - "_currentMinute": -1 + "_create": create }); $.fritteli.uhr.register = uhrGlobals.registerLanguage; /**