![]() 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 : |
/*** module: node_modules/absol/src/HTML5/DomSignal.js ***/ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.setDomImmediate = setDomImmediate; exports.clearDomImmediate = clearDomImmediate; exports.default = void 0; var _EventEmitter = _interopRequireDefault(require("./EventEmitter")); var _AElement = _interopRequireDefault(require("./AElement")); var _OOP = _interopRequireDefault(require("./OOP")); var _AttachHook = _interopRequireDefault(require("./AttachHook")); var _safeThrow = _interopRequireDefault(require("../Code/safeThrow")); /*** * * @extends EventEmitter * @param {AElement=} attachHookElt * @constructor */ function DomSignal(attachHookElt) { _EventEmitter.default.call(this); this.signals = {}; this.ev_attached = this.ev_attached.bind(this); this.$attachhook = attachHookElt || this.createBuildInAttachHook(); this.$attachhookParent = attachHookElt && attachHookElt.parentElement || null; this.$attachhook.on('attached', this.ev_attached); this.$attachhook.ofDS = this; this.isPending = false; } _OOP.default.mixClass(DomSignal, _EventEmitter.default); DomSignal.prototype.createBuildInAttachHook = function () { var elt = document.createElement('img'); Object.defineProperties(elt, Object.getOwnPropertyDescriptors(_AElement.default.prototype)); Object.defineProperties(elt, Object.getOwnPropertyDescriptors(_AttachHook.default.prototype)); Object.defineProperties(elt, _AttachHook.default.property); _AElement.default.call(elt); elt.setAttribute('src', ''); elt.defineEvent('attached'); elt.addStyle('display', 'none'); _AttachHook.default.call(elt); elt.cancelWaiting(); return elt; }; DomSignal.prototype.execSignal = function () { var signals = this.signals; this.signals = {}; this.isPending = false; for (var name in signals) { this.fire.apply(this, [name].concat(signals[name])); } }; DomSignal.prototype.emit = function (name) { if (this.$attachhook && (this.$attachhook.canceled || this.$attachhook.attached) && !this.isPending) { this.$attachhook.remove(); this.$attachhook.resetState(); } this.signals[name] = Array.prototype.slice.call(arguments, 1); this.isPending = true; if (!this.$attachhookParent) { this.$attachhookParent = document.body; } if (!this.$attachhook.parentElement) { this.$attachhook.resetState(); this.$attachhookParent.appendChild(this.$attachhook); } }; DomSignal.prototype.ev_attached = function () { this.execSignal(); }; var _default = DomSignal; exports.default = _default; var currentAT = null; var callbackList = {}; var id = 0; function setDomImmediate(callback) { var cid = ++id; callbackList[cid] = { exec: callback, args: Array.prototype.slice.call(arguments, 1) }; if (!currentAT) { currentAT = document.createElement('img'); currentAT.setAttribute('src', ''); currentAT.addEventListener('error', function () { currentAT.remove(); currentAT = null; Object.keys(callbackList).map(function (key) { var cb = callbackList[key]; delete callbackList[key]; if (cb) { try { cb.exec.call(null, cb.args); } catch (error) { (0, _safeThrow.default)(error); } } }); }); } return cid; } function clearDomImmediate(id) { delete callbackList[id]; }