MCPcopy Index your code
hub / github.com/bigskysoftware/_hyperscript / resolve

Method resolve

tools/common/_hyperscript.iife.js:6455–6491  ·  view source on GitHub ↗
(context, { on, time })

Source from the content-addressed store, hash-verified

6453 }
6454 }
6455 resolve(context, { on, time }) {
6456 if (this.variant === "event") {
6457 var target = on ? on : context.me;
6458 if (!(target instanceof EventTarget))
6459 throw new Error("Not a valid event target: " + this.on.sourceFor());
6460 const events = this.event;
6461 return new Promise((resolve) => {
6462 var resolved = false;
6463 for (const eventInfo of events) {
6464 var listener = (evt) => {
6465 context.result = evt;
6466 if (eventInfo.name && eventInfo.args) {
6467 for (const arg of eventInfo.args) {
6468 context.locals[arg.value] = evt[arg.value] || (evt.detail ? evt.detail[arg.value] : null);
6469 }
6470 }
6471 if (!resolved) {
6472 resolved = true;
6473 resolve(this.findNext(context));
6474 }
6475 };
6476 if (eventInfo.name) {
6477 target.addEventListener(eventInfo.name, listener, { once: true });
6478 } else {
6479 const timeValue = eventInfo.evaluate(context);
6480 setTimeout(listener, timeValue, timeValue);
6481 }
6482 }
6483 });
6484 } else {
6485 return new Promise((resolve) => {
6486 setTimeout(() => {
6487 resolve(this.findNext(context));
6488 }, time);
6489 });
6490 }
6491 }
6492 };
6493 var SendCommand = class _SendCommand extends Command {
6494 static keyword = ["send", "trigger"];

Callers

nothing calls this directly

Calls 4

setTimeoutFunction · 0.70
sourceForMethod · 0.45
evaluateMethod · 0.45
findNextMethod · 0.45

Tested by

no test coverage detected