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-acomp__js__mobile__MApplication.js
/*** module: node_modules/absol-acomp/js/mobile/MApplication.js ***/
"use strict";

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

var _Fragment = _interopRequireDefault(require("absol/src/AppPattern/Fragment"));

require("../../css/mobileapp.css");

var _ACore = require("../../ACore");

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


/**
 * @extends Fragment
 * @constructor
 */
function MApplication() {
  _Fragment.default.call(this);

  this.stack = [];
  this.pendingLoop = [];
  this.loopRunning = false;
}

_OOP.default.mixClass(MApplication, _Fragment.default);

MApplication.prototype.createView = function () {
  this.$view = (0, _ACore._)({
    class: ['am-application', 'am-stack']
  });
};

MApplication.prototype.postHandler = function (handler) {
  this.pendingLoop.push(handler);
  if (this.loopRunning) return;

  while (this.pendingLoop.length > 0) {
    this.pendingLoop.shift()();
  }
};

MApplication.prototype.startActivity = function (clazz, bundle) {
  var handle = () => {
    var curAct = this.stack[this.stack.length - 1];

    if (curAct) {
      curAct.pause();
    }

    var newAct = new clazz(bundle);
    var view = newAct.getView();
    this.$view.addChild(view);
    this.stack.push(newAct);
    newAct.attach(this);
    newAct.onCreated();

    if (this.state === "PAUSE") {
      newAct.start(true);
    } else if (this.state === 'RUNNING') {
      if (curAct) curAct.pause();
      newAct.start();
    }
  };

  this.postHandler(handle);
};

MApplication.prototype.replaceActivity = function (clazz, bundle) {
  var curAct = this.stack[this.stack.length - 1];
  if (curAct) this.finishActivity(curAct, true);
  this.startActivity(clazz, bundle);
};
/**
 *
 * @param act
 * @param {boolean=} replace
 */


MApplication.prototype.finishActivity = function (act, replace) {
  this.postHandler(() => {
    var curAct = this.stack[this.stack.length - 1];

    if (curAct) {
      if (curAct !== act) throw new Error("Activity stack error!");
      curAct.detach();
      curAct.getView().remove();
      this.stack.pop();
      curAct.destroy();
      curAct = this.stack[this.stack.length - 1];

      if (curAct && this.state === 'RUNNING' && !replace) {
        curAct.resume();
      }
    }
  });
};

MApplication.prototype.onStart = function () {
  for (var i = 0; i < this.stack.length; ++i) {
    this.stack[i].start(true);
  }
};

MApplication.prototype.onResume = function () {
  var curAct = this.stack[this.stack.length - 1];

  if (curAct) {
    curAct.resume(true);
  }
};

MApplication.prototype.onPause = function () {
  var curAct = this.stack[this.stack.length - 1];

  if (curAct) {
    curAct.pause();
  }
};

MApplication.prototype.onStop = function () {
  for (var i = this.stack.length - 1; i >= 0; --i) {
    this.stack[i].stop();
  }
};

MApplication.prototype.onDestroy = function () {
  while (this.stack.length) {
    this.stack.pop().destroy();
  }
};

var _default = MApplication;
exports.default = _default;

VaKeR 2022