ClockFace: fix fast loading
parent
640fe08d9e
commit
825a705339
|
|
@ -58,6 +58,7 @@ function ClockFace(options) {
|
||||||
|
|
||||||
ClockFace.prototype.tick = function() {
|
ClockFace.prototype.tick = function() {
|
||||||
"ram"
|
"ram"
|
||||||
|
if (this._removed) return;
|
||||||
const time = new Date();
|
const time = new Date();
|
||||||
const now = {
|
const now = {
|
||||||
d: `${time.getFullYear()}-${time.getMonth()}-${time.getDate()}`,
|
d: `${time.getFullYear()}-${time.getMonth()}-${time.getDate()}`,
|
||||||
|
|
@ -131,6 +132,7 @@ ClockFace.prototype.resume = function() {
|
||||||
this.tick();
|
this.tick();
|
||||||
};
|
};
|
||||||
ClockFace.prototype.remove = function() {
|
ClockFace.prototype.remove = function() {
|
||||||
|
this._removed = true;
|
||||||
if (this._timeout) clearTimeout(this._timeout);
|
if (this._timeout) clearTimeout(this._timeout);
|
||||||
Bangle.removeListener("lcdPower", this._onLcd);
|
Bangle.removeListener("lcdPower", this._onLcd);
|
||||||
if (this._remove) this._remove.apply(this);
|
if (this._remove) this._remove.apply(this);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue