![]() 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-tutor/js/Tutor.js ***/ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _expressionList = _interopRequireDefault(require("./scriptor/expressionList")); var _findNode = _interopRequireDefault(require("./util/findNode")); var _findAllNodes = _interopRequireDefault(require("./util/findAllNodes")); var _Context = _interopRequireDefault(require("absol/src/AppPattern/Context")); var _OOP = _interopRequireDefault(require("absol/src/HTML5/OOP")); var _EventEmitter = _interopRequireDefault(require("absol/src/HTML5/EventEmitter")); var _stringUtils = require("absol/src/String/stringUtils"); var _TutorEngine = _interopRequireDefault(require("./scriptor/TutorEngine")); var _safeThrow = _interopRequireDefault(require("absol/src/Code/safeThrow")); /*** * @augments Context * @param view * @param script * @param option * @constructor */ function Tutor(view, script, option) { _EventEmitter.default.call(this); _Context.default.call(this); this.$view = view; /*** * * @type {*|TProgram} */ this.prorgram = this.programCache[(0, _stringUtils.stringHashCode)(script)] || _TutorEngine.default.compile(script); /*** * * @type {TProcess} */ this.process = this.prorgram.newProcess(); this.process.tutor = this; this.option = Object.assign({ messageDelay: 300 }, option); this.debug.status = 'NOT_START'; } _OOP.default.mixClass(Tutor, _EventEmitter.default, _Context.default); Tutor.prototype.programCache = {}; Tutor.prototype.exec = function () { this.debug.status = "RUNNING"; return this.process.exec().then(function (result) { this.debug.status = "FINISH"; return result; }.bind(this)).catch(function (error) { (0, _safeThrow.default)(error); if (error instanceof Error) { this.debug.status = "ERROR"; throw error; } }.bind(this)); }; Tutor.prototype.stop = function () { this.process.stop(); }; Tutor.prototype.findNode = function (query, unsafe) { var elt = (0, _findNode.default)(query, this.$view); if (!elt && !unsafe) throw new Error('Can not find element with query="' + query + '"'); return elt; }; Tutor.prototype.findAllNode = function (query) { return (0, _findAllNodes.default)(query, this.$view); }; Tutor.prototype.getStatus = function () { if (this.debug.status === "NOT_START") return { status: "NOT_START" }; if (this.debug.status === "RUNNING" || this.debug.status === "ERROR") return { status: this.debug.status, code: this.process.program.code.substr(this.debug.loc.start, this.debug.loc.end - this.debug.loc.start), row: this.debug.loc.row - 1, col: this.debug.loc.col }; return { status: "FINISH" }; }; Object.defineProperty(Tutor.prototype, 'debug', { get: function () { return this.process.debug; } }); var _default = Tutor; exports.default = _default;