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

Method resolve

www/js/_hyperscript-max.js:8865–8945  ·  view source on GitHub ↗
(context, { from, to, using, over })

Source from the content-addressed store, hash-verified

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