MCPcopy Create free account
hub / github.com/bigskysoftware/_hyperscript / insertAborts

Function insertAborts

www/js/_hyperscript.esm.js:8960–8982  ·  view source on GitHub ↗
(cmd, inLoop, visited)

Source from the content-addressed store, hash-verified

8958var ESCAPE_TYPES = /* @__PURE__ */ new Set(["returnCommand", "exitCommand", "haltCommand", "breakCommand", "continueCommand"]);
8959var LOOP_TYPES = /* @__PURE__ */ new Set(["breakCommand", "continueCommand"]);
8960function insertAborts(cmd, inLoop, visited) {
8961 if (!visited) visited = /* @__PURE__ */ new Set();
8962 if (!cmd || visited.has(cmd)) return;
8963 visited.add(cmd);
8964 var childInLoop = inLoop || cmd.loop !== void 0;
8965 for (var key of Object.keys(cmd)) {
8966 if (key === "parent") continue;
8967 var val = cmd[key];
8968 if (val instanceof ParseElement && ESCAPE_TYPES.has(val.type)) {
8969 if (!LOOP_TYPES.has(val.type) || !inLoop) {
8970 var abort = new AbortViewTransition();
8971 abort.next = val;
8972 cmd[key] = abort;
8973 visited.add(abort);
8974 }
8975 }
8976 for (var item of [val].flat()) {
8977 if (item instanceof ParseElement) {
8978 insertAborts(item, childInLoop, visited);
8979 }
8980 }
8981 }
8982}
8983var ViewTransitionTick = class extends Command {
8984 constructor() {
8985 super();

Callers 1

parseMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected