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

Method constructor

src/Timer.ts:243–269  ·  view source on GitHub ↗
(
    private _media: HTMLMediaElement,
    private _ticker: ITicker = new AnimationFrameTicker()
  )

Source from the content-addressed store, hash-verified

241 private _disposes: IDisposable[] = []
242
243 constructor(
244 private _media: HTMLMediaElement,
245 private _ticker: ITicker = new AnimationFrameTicker()
246 ) {
247 this._disposes = [
248 addDisposableDomListener(_media, 'error', () => { console.error('error') }),
249 addDisposableDomListener(_media, 'waiting', () => { console.log('waiting') }),
250 addDisposableDomListener(_media, 'durationchange', () => { console.log('durationchange') }),
251 addDisposableDomListener(_media, 'canplay', () => { this._ready = true; this._onReadyCb() }),
252 addDisposableDomListener(_media, 'play', () => { this._setState('Running') }),
253 addDisposableDomListener(_media, 'pause', () => { this._setState('Paused') }),
254 addDisposableDomListener(_media, 'ended', () => {
255 this.stop()
256 this._onTickCb(this.time)
257 }),
258 addDisposableDomListener(_media, 'seeking', () => {
259 if (this.isRunning()) {
260 this._ticker.stop()
261 }
262 }),
263 addDisposableDomListener(_media, 'seeked', () => {
264 if (this.isRunning()) {
265 this._ticker.start(this._tick.bind(this))
266 }
267 }),
268 ]
269 }
270
271 public get ready(): boolean { return this._ready }
272 public get progress(): number { return this._media.currentTime / this._media.duration }

Callers

nothing calls this directly

Calls 6

_setStateMethod · 0.95
stopMethod · 0.95
isRunningMethod · 0.95
addDisposableDomListenerFunction · 0.90
stopMethod · 0.65
startMethod · 0.65

Tested by

no test coverage detected