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

Method resolve

www/js/_hyperscript.js:8866–8946  ·  view source on GitHub ↗
(context, { from, to, using, over })

Source from the content-addressed store, hash-verified

8864 return new _TransitionCommand(propExprs, from, to, usingExpr, over);
8865 }
8866 resolve(context, { from, to, using, over }) {
8867 var cmd = this;
8868 var runtime2 = context.meta.runtime;
8869 var target;
8870 if (this.propExprs[0].root) {
8871 target = this.propExprs[0].root.evaluate(context);
8872 runtime2.nullCheck(target, this.propExprs[0].root);
8873 } else {
8874 target = context.me;
8875 }
8876 var promises = [];
8877 runtime2.implicitLoop(target, function(target2) {
8878 promises.push(new Promise(function(resolve) {
8879 var initialTransition = target2.style.transition;
8880 if (over) {
8881 target2.style.transition = "all " + over + "ms ease-in";
8882 } else if (using) {
8883 target2.style.transition = using;
8884 } else {
8885 target2.style.transition = config.defaultTransition;
8886 }
8887 var internalData = runtime2.getInternalData(target2);
8888 if (!internalData.transitionInitials) internalData.transitionInitials = {};
8889 var initialValues = internalData.transitionInitials;
8890 for (var j = 0; j < cmd.propExprs.length; j++) {
8891 if (!(j in initialValues)) {
8892 initialValues[j] = cmd.propExprs[j].evaluate(context);
8893 }
8894 }
8895 for (var j = 0; j < cmd.propExprs.length; j++) {
8896 if (from[j] != null) {
8897 var lhs = {};
8898 for (var key in cmd.propExprs[j].lhs) {
8899 var e = cmd.propExprs[j].lhs[key];
8900 lhs[key] = e && e.evaluate ? e.evaluate(context) : e;
8901 }
8902 cmd.propExprs[j].set(context, lhs, from[j]);
8903 }
8904 }
8905 var transitionStarted = false;
8906 var resolved = false;
8907 target2.addEventListener("transitionend", function() {
8908 if (!resolved) {
8909 target2.style.transition = initialTransition;
8910 resolved = true;
8911 resolve();
8912 }
8913 }, { once: true });
8914 target2.addEventListener("transitionstart", function() {
8915 transitionStarted = true;
8916 }, { once: true });
8917 setTimeout(function() {
8918 if (!resolved && !transitionStarted) {
8919 target2.style.transition = initialTransition;
8920 resolved = true;
8921 resolve();
8922 }
8923 }, 100);

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected