'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _ora = require('ora');

var _ora2 = _interopRequireDefault(_ora);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

class GlobalSpinner {
  constructor(spinnerLabel) {
    this.spinner = (0, _ora2.default)(spinnerLabel);
    this.jobsCounter = 0;
    this.queueSize = 0;
  }

  stop() {
    this.spinner.stop();
    this.jobsCounter -= 1;
  }

  start() {
    this.jobsCounter += 1;
    if (this.jobsCounter === this.queueSize) {
      this.spinner.start();
    }
  }
}

class SimpleSpinner {
  constructor(spinnerLabel) {
    this.spinner = (0, _ora2.default)(spinnerLabel);
  }

  start() {
    this.spinner.start();
    return this;
  }

  stop() {
    this.spinner.stop();
    return this;
  }
}

exports.default = {
  GlobalSpinner,
  SimpleSpinner
};
module.exports = exports['default'];
//# sourceMappingURL=spinner.js.map