(pausedInitially = true)
| 41 | } |
| 42 | |
| 43 | runTimer (pausedInitially = true) { |
| 44 | const total = convertFromHoursToMilliseconds(this.hours) + convertFromMinutesToMilliseconds(this.minutes); |
| 45 | this.totalTime = total; |
| 46 | this.currentTimeInMillis = total; |
| 47 | this.logger.debug('STARTING TIMER FOR ' + this.totalTime + 'ms'); |
| 48 | this.start = Date.now(); |
| 49 | const expected = Date.now() + this.tickInterval; |
| 50 | this.timesUpPromise = new Promise((resolve) => { |
| 51 | this.timesUpResolver = resolve; |
| 52 | }); |
| 53 | const instance = this; |
| 54 | if (!pausedInitially) { |
| 55 | this.ticking = setTimeout(function () { |
| 56 | stepFn( |
| 57 | instance, |
| 58 | expected |
| 59 | ); |
| 60 | }, this.tickInterval); |
| 61 | } |
| 62 | |
| 63 | return this.timesUpPromise; |
| 64 | } |
| 65 | |
| 66 | stopTimer () { |
| 67 | if (this.ticking) { |
no test coverage detected