|
86 | 86 |
|
87 | 87 | </div> |
88 | 88 | <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> |
92 | 92 | </div> |
93 | 93 | </template> |
94 | 94 | </dom-module> |
|
104 | 104 | time: '000000', |
105 | 105 | /*** |
106 | 106 | * @private |
| 107 | + * @default null |
107 | 108 | */ |
108 | 109 | timer: null, |
109 | 110 |
|
|
146 | 147 | * |
147 | 148 | * @attribute startFrom |
148 | 149 | * @type Number |
149 | | - * @value null |
| 150 | + * @default null |
150 | 151 | */ |
151 | 152 | startFrom: { |
152 | 153 | type: Number, |
|
157 | 158 | * |
158 | 159 | * @attribute auto |
159 | 160 | * @type Boolean |
160 | | - * @value false |
| 161 | + * @default false |
161 | 162 | */ |
162 | 163 | auto: { |
163 | 164 | type: Boolean, |
164 | 165 | value: false |
165 | 166 | } |
166 | 167 | }, |
167 | 168 | /** |
168 | | - * The `createClock` method start a clock that display the current time. |
| 169 | + * The `_createClock` method start a clock that display the current time. |
169 | 170 | * |
170 | | - * @method createClock |
| 171 | + * @method _createClock |
| 172 | + * @private |
171 | 173 | */ |
172 | | - createClock: function() { |
| 174 | + _createClock: function() { |
173 | 175 | this.time = moment().format('HHmmss'); |
174 | | - this.async(this.createClock, 1000); |
| 176 | + this.async(this._createClock, 1000); |
175 | 177 | }, |
176 | 178 | /** |
177 | | - * The `createTimer` method create a timer |
| 179 | + * The `_createTimer` method create a timer |
178 | 180 | * |
179 | | - * @method createTimer |
| 181 | + * @method _createTimer |
| 182 | + * @private |
180 | 183 | */ |
181 | | - createTimer: function() { |
| 184 | + _createTimer: function() { |
182 | 185 | if(this.isRunning) { |
183 | 186 | this.time = this.timer.add(1, 's').format('HHmmss'); |
184 | | - this.async(this.createTimer, 1000); |
| 187 | + this.async(this._createTimer, 1000); |
185 | 188 | } |
186 | 189 | }, |
187 | 190 | /** |
188 | | - * The `createCountdown` method create a countdown |
| 191 | + * The `_createCountdown` method create a countdown |
189 | 192 | * |
190 | | - * @method createCountdown |
| 193 | + * @method _createCountdown |
| 194 | + * @private |
191 | 195 | */ |
192 | | - createCountdown: function() { |
| 196 | + _createCountdown: function() { |
193 | 197 | if(this.isRunning) { |
194 | 198 | if(this.time > 0) { |
195 | 199 | this.time = this.timer.subtract(1, 's').format('HHmmss'); |
196 | | - this.async(this.createCountdown, 1000); |
| 200 | + this.async(this._createCountdown, 1000); |
197 | 201 | } |
198 | 202 | } |
199 | 203 | }, |
200 | 204 | /** |
201 | | - * The `startCount` method starts the timer or the countdown |
| 205 | + * The `_startCount` method starts the timer or the countdown |
202 | 206 | * |
203 | | - * @method startCount |
| 207 | + * @method _startCount |
| 208 | + * @private |
204 | 209 | */ |
205 | | - startCount: function() { |
| 210 | + _startCount: function() { |
206 | 211 | if(!this.timer) { |
207 | 212 | this.timer = moment().hours(0).minutes(this.startFrom || 0).seconds(0); |
208 | 213 | } |
209 | 214 | this.isRunning = true; |
210 | | - this.startFrom ? this.createCountdown() : this.createTimer(); |
| 215 | + this.startFrom ? this._createCountdown() : this._createTimer(); |
211 | 216 | }, |
212 | 217 | /** |
213 | | - * The `stopCount` stop the running timer or countdown |
| 218 | + * The `_stopCount` stop the running timer or countdown |
214 | 219 | * |
215 | | - * @method stopCount |
| 220 | + * @method _stopCount |
| 221 | + * @private |
216 | 222 | */ |
217 | | - stopCount: function() { |
| 223 | + _stopCount: function() { |
218 | 224 | this.isRunning = false; |
219 | 225 | }, |
220 | 226 | /** |
221 | | - * The `resetCount` reset che counter |
| 227 | + * The `_resetCount` reset che counter |
222 | 228 | * |
223 | | - * @method resetCount |
| 229 | + * @method _resetCount |
| 230 | + * @private |
224 | 231 | */ |
225 | | - resetCount: function() { |
| 232 | + _resetCount: function() { |
226 | 233 | this.isRunning = false; |
227 | 234 | this.time = this.startFrom ? '00' + this.startFrom + '00' : '000000'; |
228 | 235 | this.timer = null; |
229 | 236 | }, |
230 | 237 |
|
231 | 238 | ready: function() { |
232 | | - this.resetCount(); |
| 239 | + this._resetCount(); |
233 | 240 |
|
234 | 241 | switch(this.displayMode) { |
235 | 242 | case 'timer': |
236 | 243 | if(this.auto === true) { |
237 | | - this.startCount(); |
| 244 | + this._startCount(); |
238 | 245 | } |
239 | 246 | break; |
240 | 247 | case 'countdown': |
241 | 248 | if(this.auto === true) { |
242 | | - this.createCountdown(); |
| 249 | + this._createCountdown(); |
243 | 250 | } |
244 | 251 | break; |
245 | 252 | default: |
246 | | - this.createClock(); |
| 253 | + this._createClock(); |
247 | 254 | } |
248 | 255 | if(this.startFrom) { |
249 | 256 | this.time = '00' + this.startFrom + '00'; |
|
0 commit comments