export default class WsCardLoadingIndicatorController {
  static $inject = ['$timeout'];
  constructor($timeout) {
    this.$timeout = $timeout;
  }

  $onInit = () => {
    this._setShow(this.ready);
  }

  $onChanges = (changes) => {
    if (changes.ready) {
      this._setShow(changes.ready.currentValue);
    }
  };

  _setShow = (ready) => {
    if (this.delay) {
      this.$timeout(
        () => { this.show = ready; },
        this.delay);
    } else {
      this.show = ready;
    }
  }
}
