MCPcopy Index your code
hub / github.com/JavaCS3/xterm-player / start

Method start

src/Timer.ts:202–219  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

200 public isStopped(): boolean { return this._state === 'Stopped' }
201
202 public start(): void {
203 if (this.isRunning()) { return }
204 if ((!this.isRunning()) && (this.time >= this._duration)) { return }
205 this._setState('Running')
206 this._lasttime = this._ticker.now()
207 this._ticker.start(() => {
208 const now = this._ticker.now()
209 const delta = (now - this._lasttime) * this._timescale
210 if ((this._time + delta) > this._duration) {
211 this._time = this._duration
212 this.stop()
213 } else {
214 this._time += delta
215 }
216 this._lasttime = now
217 this._onTickCb(this._time)
218 })
219 }
220 public pause(): void {
221 this._ticker.stop()
222 this._setState('Paused')

Callers

nothing calls this directly

Calls 5

isRunningMethod · 0.95
_setStateMethod · 0.95
stopMethod · 0.95
nowMethod · 0.65
startMethod · 0.65

Tested by

no test coverage detected