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

Method resolve

tools/common/_hyperscript.iife.js:8416–8496  ·  view source on GitHub ↗
(context, { from, to, using, over })

Source from the content-addressed store, hash-verified

8414 return new _TransitionCommand(propExprs, from, to, usingExpr, over);
8415 }
8416 resolve(context, { from, to, using, over }) {
8417 var cmd = this;
8418 var runtime2 = context.meta.runtime;
8419 var target;
8420 if (this.propExprs[0].root) {
8421 target = this.propExprs[0].root.evaluate(context);
8422 runtime2.nullCheck(target, this.propExprs[0].root);
8423 } else {
8424 target = context.me;
8425 }
8426 var promises = [];
8427 runtime2.implicitLoop(target, function(target2) {
8428 promises.push(new Promise(function(resolve) {
8429 var initialTransition = target2.style.transition;
8430 if (over) {
8431 target2.style.transition = "all " + over + "ms ease-in";
8432 } else if (using) {
8433 target2.style.transition = using;
8434 } else {
8435 target2.style.transition = config.defaultTransition;
8436 }
8437 var internalData = runtime2.getInternalData(target2);
8438 if (!internalData.transitionInitials) internalData.transitionInitials = {};
8439 var initialValues = internalData.transitionInitials;
8440 for (var j = 0; j < cmd.propExprs.length; j++) {
8441 if (!(j in initialValues)) {
8442 initialValues[j] = cmd.propExprs[j].evaluate(context);
8443 }
8444 }
8445 for (var j = 0; j < cmd.propExprs.length; j++) {
8446 if (from[j] != null) {
8447 var lhs = {};
8448 for (var key in cmd.propExprs[j].lhs) {
8449 var e = cmd.propExprs[j].lhs[key];
8450 lhs[key] = e && e.evaluate ? e.evaluate(context) : e;
8451 }
8452 cmd.propExprs[j].set(context, lhs, from[j]);
8453 }
8454 }
8455 var transitionStarted = false;
8456 var resolved = false;
8457 target2.addEventListener("transitionend", function() {
8458 if (!resolved) {
8459 target2.style.transition = initialTransition;
8460 resolved = true;
8461 resolve();
8462 }
8463 }, { once: true });
8464 target2.addEventListener("transitionstart", function() {
8465 transitionStarted = true;
8466 }, { once: true });
8467 setTimeout(function() {
8468 if (!resolved && !transitionStarted) {
8469 target2.style.transition = initialTransition;
8470 resolved = true;
8471 resolve();
8472 }
8473 }, 100);

Callers

nothing calls this directly

Calls 7

setTimeoutFunction · 0.70
evaluateMethod · 0.45
nullCheckMethod · 0.45
implicitLoopMethod · 0.45
getInternalDataMethod · 0.45
setMethod · 0.45
findNextMethod · 0.45

Tested by

no test coverage detected