renamed _timer to timer

This commit is contained in:
Manuel Friedli 2014-07-03 21:16:47 +02:00
parent 08cca0a915
commit ec9b44427c

View file

@ -58,7 +58,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
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 <http://www.gnu.org/licenses/>.
};
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 <http://www.gnu.org/licenses/>.
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 <http://www.gnu.org/licenses/>.
// 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 <http://www.gnu.org/licenses/>.
// 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 <http://www.gnu.org/licenses/>.
"theme": setTheme,
"time": setTime,
// constructor method
"_create": create,
// private variables
"_id": -1,
"_timer": null,
"_currentMinute": -1
"_create": create
});
$.fritteli.uhr.register = uhrGlobals.registerLanguage;
/**