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

Method debugPrintElement_

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

* Print out the element's bound attributes and respective expression values. * @param {!Element} element * @private

(element)

Source from the content-addressed store, hash-verified

1700 * @private
1701 */
1702 debugPrintElement_(element) {
1703 const index = findIndex(this.boundElements_, (boundElement) => {
1704 return boundElement.element == element;
1705 });
1706 if (index < 0) {
1707 user().info(TAG, 'Element has no bindings:', element);
1708 return;
1709 }
1710 // Evaluate expressions in bindings in `element`.
1711 const promises = [];
1712 const {boundProperties} = this.boundElements_[index];
1713 boundProperties.forEach((boundProperty) => {
1714 const {expressionString} = boundProperty;
1715 promises.push(this.evaluateExpression_(expressionString, this.state_));
1716 });
1717 // Print the map of attribute to expression value for `element`.
1718 Promise.all(promises).then((results) => {
1719 const output = map();
1720 boundProperties.forEach((boundProperty, i) => {
1721 const {property} = boundProperty;
1722 output[property] = results[i];
1723 });
1724 user().info(TAG, output);
1725 });
1726 }
1727
1728 /**
1729 * @param {string} expression

Callers 1

debugPrintState_Method · 0.95

Calls 8

evaluateExpression_Method · 0.95
findIndexFunction · 0.90
userFunction · 0.90
mapFunction · 0.90
infoMethod · 0.80
forEachMethod · 0.45
pushMethod · 0.45
thenMethod · 0.45

Tested by

no test coverage detected