VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/libs/absol-full/dist/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/libs/absol-full/dist/js/mdls__absol-tutor__js__scriptor__UserBaseAction.js
/*** module: node_modules/absol-tutor/js/scriptor/UserBaseAction.js ***/
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _OOP = _interopRequireDefault(require("absol/src/HTML5/OOP"));

var _BaseCommand = _interopRequireDefault(require("./BaseCommand"));

var _TCommand = require("../engine/TCommand");

var _BaseState = _interopRequireDefault(require("./BaseState"));


/***
 * @extends BaseState
 * @param {BaseCommand} command
 * @constructor
 */
function StateWaitElt(command) {
  _BaseState.default.call(this, command);

  this.checkElt = this.checkElt.bind(this);
  this.countDown = 20;
}

_OOP.default.mixClass(StateWaitElt, _BaseState.default);

StateWaitElt.prototype.onStart = function () {
  this.inv = setInterval(this.checkElt, 100);
};

StateWaitElt.prototype.onStop = function () {
  clearInterval(this.inv);
};

StateWaitElt.prototype.checkElt = function () {
  this.command.elt = this.command.findNode(this.args.eltPath, true);
  this.countDown--;

  if (this.countDown <= 0) {
    this.command.reject(new Error("Could not find " + this.args.eltPath));
    return;
  }

  var error;

  if (this.command.elt) {
    error = this.command.verifyElt();

    if (error) {
      this.command.reject(error);
    } else {
      this.command.assignTarget(this.command.elt);
      this.goto('show_message');
    }
  }
};
/***
 * @extends BaseState
 * @param {BaseCommand} command
 * @constructor
 */


function StateShowMessage(command) {
  _BaseState.default.call(this, command);
}

_OOP.default.mixClass(StateShowMessage, _BaseState.default);

StateShowMessage.prototype.onStart = function () {
  this.command.showDelayToast(this.args.message).then(function () {
    this.goto('user_begin');
  }.bind(this));
};
/***
 * @extends BaseCommand
 * @constructor
 */


function UserBaseAction() {
  _BaseCommand.default.apply(this, arguments);
  /***
   *
   * @type {null|AElement}
   */


  this.elt = null;
  this.hadWrongAction = false;
}

(0, _TCommand.inheritCommand)(UserBaseAction, _BaseCommand.default);
/***
 *
 * @return {Promise<void>}
 */

UserBaseAction.prototype.requestUserAction = function () {
  return Promise.resolve();
};
/***
 *
 * @returns {null|Error}
 */


UserBaseAction.prototype.verifyElt = function () {
  return null;
};

UserBaseAction.prototype.stateClasses.entry = StateWaitElt;
UserBaseAction.prototype.stateClasses.show_message = StateShowMessage;
UserBaseAction.prototype.stateClasses.user_begin = UserBaseAction.prototype.stateClasses.finish;
var _default = UserBaseAction;
exports.default = _default;

VaKeR 2022