MCPcopy Create free account
hub / github.com/ampproject/amphtml / evaluate_

Method evaluate_

extensions/amp-bind/0.1/bind-impl.js:1050–1072  ·  view source on GitHub ↗

* Reevaluates all expressions and returns a map of expressions to results. * @return {!Promise<!{[key: string]: BindExpressionResultDef}>} * @private

()

Source from the content-addressed store, hash-verified

1048 * @private
1049 */
1050 evaluate_() {
1051 const evaluatePromise = this.ww_('bind.evaluateBindings', [this.state_]);
1052 return evaluatePromise.then((returnValue) => {
1053 const {errors, results} = returnValue;
1054 // Report evaluation errors.
1055 Object.keys(errors).forEach((expressionString) => {
1056 const elements = this.expressionToElements_[expressionString];
1057 if (elements.length > 0) {
1058 const evalError = errors[expressionString];
1059 const userError = user().createError(
1060 '%s: Expression evaluation error in "%s". %s',
1061 TAG,
1062 expressionString,
1063 evalError.message
1064 );
1065 userError.stack = evalError.stack;
1066 this.reportError_(userError, elements[0]);
1067 }
1068 });
1069 dev().info(TAG, 'evaluation:', results);
1070 return results;
1071 });
1072 }
1073
1074 /**
1075 * Verifies expression results vs. current DOM state and returns an

Callers 3

setStateMethod · 0.95
rescan_Method · 0.95
initialize_Method · 0.95

Calls 8

ww_Method · 0.95
reportError_Method · 0.95
userFunction · 0.90
devFunction · 0.90
infoMethod · 0.80
thenMethod · 0.45
forEachMethod · 0.45
createErrorMethod · 0.45

Tested by

no test coverage detected