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

Function insertAborts

www/js/_hyperscript.js:8962–8984  ·  view source on GitHub ↗
(cmd, inLoop, visited)

Source from the content-addressed store, hash-verified

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

Callers 1

parseMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected