From 02b29032d859a015a98f8b6000eac20118173c2e Mon Sep 17 00:00:00 2001 From: John Foerch Date: Tue, 14 Feb 2012 19:31:13 -0500 Subject: [PATCH] clock_widget: style --- modules/mode-line.js | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/modules/mode-line.js b/modules/mode-line.js index 672b879..cfdf31c 100644 --- a/modules/mode-line.js +++ b/modules/mode-line.js @@ -200,25 +200,28 @@ function clock_widget (window) { this.timer_ID = window.setTimeout(this.do_update, 0); this.timer_timeout = true; } -clock_widget.prototype.__proto__ = text_widget.prototype; -clock_widget.prototype.update = function () { - var time = new Date(); - this.view.text = time.toLocaleFormat(clock_time_format); - if (time.getSeconds() > 0 || time.getMilliseconds() > 100) { - this.window.clearTimeout(this.timer_ID); - var time = time.getSeconds() * 1000 + time.getMilliseconds(); - time = 60000 - time; - this.timer_ID = this.window.setTimeout(this.do_update, time); - this.timer_timeout = true; - } else if (this.timer_timeout) { +clock_widget.prototype = { + constructor: clock_widget, + __proto__: text_widget.prototype, + update: function () { + var time = new Date(); + this.view.text = time.toLocaleFormat(clock_time_format); + if (time.getSeconds() > 0 || time.getMilliseconds() > 100) { + this.window.clearTimeout(this.timer_ID); + var time = time.getSeconds() * 1000 + time.getMilliseconds(); + time = 60000 - time; + this.timer_ID = this.window.setTimeout(this.do_update, time); + this.timer_timeout = true; + } else if (this.timer_timeout) { + this.window.clearTimeout(this.timer_ID); + this.timer_ID = this.window.setInterval(this.do_update, 60000); + this.timer_timeout = false; + } + }, + destroy: function () { this.window.clearTimeout(this.timer_ID); - this.timer_ID = this.window.setInterval(this.do_update, 60000); - this.timer_timeout = false; } }; -clock_widget.prototype.destroy = function () { - this.window.clearTimeout(this.timer_ID); -}; function buffer_count_widget (window) { this.class_name = "buffer-count-widget"; -- 2.11.4.GIT