Skip to content

Commit b15e1e0

Browse files
committed
prefix private methods with underscore
1 parent cf48880 commit b15e1e0

File tree

1 file changed

+38
-31
lines changed

1 file changed

+38
-31
lines changed

flip-clock.html

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@
8686

8787
</div>
8888
<div class="buttons" visible$="[[showButtons]]">
89-
<button class="toggle btn" on-click="startCount" disabled$="[[isRunning]]">Start</button>
90-
<button class="toggle btn" on-click="stopCount">Stop</button>
91-
<button class="reset btn" on-click="resetCount">Reset</button>
89+
<button class="toggle btn" on-click="_startCount" disabled$="[[isRunning]]">Start</button>
90+
<button class="toggle btn" on-click="_stopCount">Stop</button>
91+
<button class="reset btn" on-click="_resetCount">Reset</button>
9292
</div>
9393
</template>
9494
</dom-module>
@@ -104,6 +104,7 @@
104104
time: '000000',
105105
/***
106106
* @private
107+
* @default null
107108
*/
108109
timer: null,
109110

@@ -146,7 +147,7 @@
146147
*
147148
* @attribute startFrom
148149
* @type Number
149-
* @value null
150+
* @default null
150151
*/
151152
startFrom: {
152153
type: Number,
@@ -157,93 +158,99 @@
157158
*
158159
* @attribute auto
159160
* @type Boolean
160-
* @value false
161+
* @default false
161162
*/
162163
auto: {
163164
type: Boolean,
164165
value: false
165166
}
166167
},
167168
/**
168-
* The `createClock` method start a clock that display the current time.
169+
* The `_createClock` method start a clock that display the current time.
169170
*
170-
* @method createClock
171+
* @method _createClock
172+
* @private
171173
*/
172-
createClock: function() {
174+
_createClock: function() {
173175
this.time = moment().format('HHmmss');
174-
this.async(this.createClock, 1000);
176+
this.async(this._createClock, 1000);
175177
},
176178
/**
177-
* The `createTimer` method create a timer
179+
* The `_createTimer` method create a timer
178180
*
179-
* @method createTimer
181+
* @method _createTimer
182+
* @private
180183
*/
181-
createTimer: function() {
184+
_createTimer: function() {
182185
if(this.isRunning) {
183186
this.time = this.timer.add(1, 's').format('HHmmss');
184-
this.async(this.createTimer, 1000);
187+
this.async(this._createTimer, 1000);
185188
}
186189
},
187190
/**
188-
* The `createCountdown` method create a countdown
191+
* The `_createCountdown` method create a countdown
189192
*
190-
* @method createCountdown
193+
* @method _createCountdown
194+
* @private
191195
*/
192-
createCountdown: function() {
196+
_createCountdown: function() {
193197
if(this.isRunning) {
194198
if(this.time > 0) {
195199
this.time = this.timer.subtract(1, 's').format('HHmmss');
196-
this.async(this.createCountdown, 1000);
200+
this.async(this._createCountdown, 1000);
197201
}
198202
}
199203
},
200204
/**
201-
* The `startCount` method starts the timer or the countdown
205+
* The `_startCount` method starts the timer or the countdown
202206
*
203-
* @method startCount
207+
* @method _startCount
208+
* @private
204209
*/
205-
startCount: function() {
210+
_startCount: function() {
206211
if(!this.timer) {
207212
this.timer = moment().hours(0).minutes(this.startFrom || 0).seconds(0);
208213
}
209214
this.isRunning = true;
210-
this.startFrom ? this.createCountdown() : this.createTimer();
215+
this.startFrom ? this._createCountdown() : this._createTimer();
211216
},
212217
/**
213-
* The `stopCount` stop the running timer or countdown
218+
* The `_stopCount` stop the running timer or countdown
214219
*
215-
* @method stopCount
220+
* @method _stopCount
221+
* @private
216222
*/
217-
stopCount: function() {
223+
_stopCount: function() {
218224
this.isRunning = false;
219225
},
220226
/**
221-
* The `resetCount` reset che counter
227+
* The `_resetCount` reset che counter
222228
*
223-
* @method resetCount
229+
* @method _resetCount
230+
* @private
224231
*/
225-
resetCount: function() {
232+
_resetCount: function() {
226233
this.isRunning = false;
227234
this.time = this.startFrom ? '00' + this.startFrom + '00' : '000000';
228235
this.timer = null;
229236
},
230237

231238
ready: function() {
232-
this.resetCount();
239+
this._resetCount();
233240

234241
switch(this.displayMode) {
235242
case 'timer':
236243
if(this.auto === true) {
237-
this.startCount();
244+
this._startCount();
238245
}
239246
break;
240247
case 'countdown':
241248
if(this.auto === true) {
242-
this.createCountdown();
249+
this._createCountdown();
243250
}
244251
break;
245252
default:
246-
this.createClock();
253+
this._createClock();
247254
}
248255
if(this.startFrom) {
249256
this.time = '00' + this.startFrom + '00';

0 commit comments

Comments
 (0)