UNPKG

@dooboostore/dom-render

Version:
41 lines (40 loc) 1.52 kB
import { ObjectUtils } from "@dooboostore/core"; var ExecuteState = /* @__PURE__ */ ((ExecuteState2) => { ExecuteState2[ExecuteState2["EXECUTE"] = 0] = "EXECUTE"; ExecuteState2[ExecuteState2["NO_EXECUTE"] = 1] = "NO_EXECUTE"; ExecuteState2[ExecuteState2["STOP"] = 2] = "STOP"; return ExecuteState2; })(ExecuteState || {}); class OperatorExecuter { constructor(rawSet, render, returnContainer, elementSource, source, afterCallBack, startingExecute = true) { this.rawSet = rawSet; this.render = render; this.returnContainer = returnContainer; this.elementSource = elementSource; this.source = source; this.afterCallBack = afterCallBack; this.startingExecute = startingExecute; } async start() { let attrValue = this.elementSource.attr; if (this.source.operatorAround?.beforeAttr) { attrValue = this.source.operatorAround.beforeAttr(attrValue, this) ?? ""; } let r = attrValue; if (r && this.startingExecute) { const optionalPath = ObjectUtils.Path.toOptionalChainPath(attrValue); r = ObjectUtils.Script.evaluate(` ${this.render.bindScript}; return ${optionalPath}`, Object.assign(this.source.obj, { __render: this.render })); } if (this.source.operatorAround?.before) { r = this.source.operatorAround?.before(r, this); } const state = await this.execute(r); this.source.operatorAround?.after?.(r, this); return state; } } export { ExecuteState, OperatorExecuter }; //# sourceMappingURL=OperatorExecuter.js.map