Skip to content

Commit e370198

Browse files
committed
- (Bug Fix) Added the autoStart property to the FlipClock.Face class declaration
1 parent ffa7015 commit e370198

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

src/flipclock/js/libs/face.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222

2323
FlipClock.Face = FlipClock.Base.extend({
2424

25+
/**
26+
* Sets whether or not the clock should start upon instantiation
27+
*/
28+
29+
autoStart: true,
30+
2531
/**
2632
* An array of jQuery objects used for the dividers (the colons)
2733
*/
@@ -51,14 +57,18 @@
5157
this.dividers = [];
5258
this.lists = [];
5359
this.base(options);
54-
this.factory = factory;
60+
this.factory = factory;
5561
},
5662

5763
/**
5864
* Build the clock face
5965
*/
6066

61-
build: function() {},
67+
build: function() {
68+
if(this.autoStart) {
69+
this.start();
70+
}
71+
},
6272

6373
/**
6474
* Creates a jQuery object used for the digit divider
@@ -69,7 +79,6 @@
6979
*/
7080

7181
createDivider: function(label, css, excludeDots) {
72-
7382
if(typeof css == "boolean" || !css) {
7483
excludeDots = css;
7584
css = label;
@@ -129,6 +138,7 @@
129138
this.factor,
130139
this.factory.original ? Math.round(this.factory.original) : 0
131140
);
141+
132142
this.flip(this.factory.original, false);
133143
},
134144

@@ -173,13 +183,11 @@
173183
*/
174184

175185
autoIncrement: function() {
176-
if (!(this.factory.time.time instanceof Date)) {
177-
if(!this.factory.countdown) {
178-
this.increment();
179-
}
180-
else {
181-
this.decrement();
182-
}
186+
if(!this.factory.countdown) {
187+
this.increment();
188+
}
189+
else {
190+
this.decrement();
183191
}
184192
},
185193

0 commit comments

Comments
 (0)