function capture(frameIndex, callback) {
  var width = $('#terminal').width();
  var height = $('#terminal').height();
  var captureRect = { x: 0, y: 0, width: width, height: height };

  if (stepsCounter != 0) {
    stepsCounter = (stepsCounter + 1) % options.step;
    return callback();
  }

  stepsCounter = (stepsCounter + 1) % options.step;

  app
    .capturePage(captureRect, frameIndex)
    .then(callback)
    .catch((err) => {
      throw err;
    });
}
Capture the current frame

@param {Number}   frameIndex
@param {Function} callback