# All files / src/utils output-filter.js

100% Statements 18/18
100% Branches 6/6
100% Functions 4/4
100% Lines 18/18

    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
    2916x

    264x
    264x
    264x
    264x
    264x

    16x
    4x
    1x

    3x
    3x

    16x
    6x
    4x

    6x
    6x
    6x

    16x
     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);
      }
    }