All files / src/utils output-filter.js

100% Statements 14/14
100% Branches 6/6
100% Functions 3/3
100% Lines 14/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29    178x 178x 178x 178x 178x       4x 1x     3x 3x       6x 4x     6x 6x 6x      
export default class OutputFilter {
  constructor (timelineController, trackName) {
    this.timelineController = timelineController;
    this.trackName = trackName;
    this.startTime = null;
    this.endTime = null;
    this.screen = null;
  }
 
  dispatchCue () {
    if (this.startTime === null) {
      return;
    }
 
    this.timelineController.addCues(this.trackName, this.startTime, this.endTime, this.screen);
    this.startTime = null;
  }
 
  newCue (startTime, endTime, screen) {
    if (this.startTime === null || this.startTime > startTime) {
      this.startTime = startTime;
    }
 
    this.endTime = endTime;
    this.screen = screen;
    this.timelineController.createCaptionsTrack(this.trackName);
  }
}