UNPKG

awv3

Version:
106 lines (87 loc) 2.45 kB
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose"; import Events from '../core/events'; import v4 from 'uuid-v4'; var _default = /*#__PURE__*/ function (_Events) { _inheritsLoose(_default, _Events); function _default(options) { var _this; if (options === void 0) { options = {}; } _this = _Events.call(this) || this; if (options !== false) { _this.id = v4(); _this.alive = false; _this.options = options; _this.socket = undefined; _this.version = undefined; _this.tasks = new Map(); _this.url = undefined; } return _this; } var _proto = _default.prototype; _proto.execute = function execute(task, factory) { return this.request({ command: 'Execute', task: task }, factory); }; _proto.result = function result(task, factory) { return this.request({ command: 'Execute', task: 'RETURN ' + task }, factory).then(function (context) { var _context$results$; return context === null || context === void 0 ? void 0 : (_context$results$ = context.results[0]) === null || _context$results$ === void 0 ? void 0 : _context$results$.result; }); }; _proto.setVerboseLevel = function setVerboseLevel(level) { return this.request({ command: 'Execute', task: 'CADH_SetVerboseLevel(' + (level || 16391) + ');' }); }; _proto.log = function log() { return this.request({ command: 'Execute', task: 'RETURN CADH_GetVerboseFileContent();' }).then(function (context) { return context.firstResult; }); }; _proto.resetLog = function resetLog() { return this.request({ command: 'Execute', task: 'CADH_ResetVerboseFile();' }); }; _proto.storeState = function storeState() { return this.request({ command: 'StoreState' }).then(function (context) { return context.firstResult; }); }; _proto.setState = function setState(data, updateGraphics) { if (updateGraphics === void 0) { updateGraphics = false; } return this.request({ command: 'LoadState', data: data, recalc: false, updateGraphics: updateGraphics }); }; _proto.recalc = function recalc() { return this.request({ command: 'Execute', task: '_C.GlobaleFunktionen.UseOnStartRecalc(_O);' }); }; return _default; }(Events); export { _default as default };