UNPKG

@alilc/lowcode-shell

Version:

Shell Layer for AliLowCodeEngine

73 lines (68 loc) 1.76 kB
import _createClass from "@babel/runtime/helpers/createClass"; import { simulatorHostSymbol, nodeSymbol } from '../symbols'; import { SimulatorRender } from '../model/simulator-render'; export var SimulatorHost = /*#__PURE__*/function () { function SimulatorHost(simulator) { this[simulatorHostSymbol] = void 0; this[simulatorHostSymbol] = simulator; } SimulatorHost.create = function create(host) { if (!host) return null; return new SimulatorHost(host); } /** * 获取 contentWindow */; var _proto = SimulatorHost.prototype; /** * 设置 host 配置值 * @param key * @param value */ _proto.set = function set(key, value) { this[simulatorHostSymbol].set(key, value); } /** * 获取 host 配置值 * @param key * @returns */; _proto.get = function get(key) { return this[simulatorHostSymbol].get(key); } /** * scroll to specific node * @param node */; _proto.scrollToNode = function scrollToNode(node) { this[simulatorHostSymbol].scrollToNode(node[nodeSymbol]); } /** * 触发组件构建,并刷新渲染画布 */; _proto.rerender = function rerender() { this[simulatorHostSymbol].rerender(); }; return _createClass(SimulatorHost, [{ key: "contentWindow", get: function get() { return this[simulatorHostSymbol].contentWindow; } /** * 获取 contentDocument */ }, { key: "contentDocument", get: function get() { return this[simulatorHostSymbol].contentDocument; } }, { key: "renderer", get: function get() { if (this[simulatorHostSymbol].renderer) { return SimulatorRender.create(this[simulatorHostSymbol].renderer); } return undefined; } }]); }();