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

Method debugPrintState_

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

* Print out the current state in the console. * @param {(!Element|string)=} opt_elementOrExpr * @private

(opt_elementOrExpr)

Source from the content-addressed store, hash-verified

1674 * @private
1675 */
1676 debugPrintState_(opt_elementOrExpr) {
1677 if (opt_elementOrExpr) {
1678 if (typeof opt_elementOrExpr == 'string') {
1679 const value = getValueForExpr(this.state_, opt_elementOrExpr);
1680 user().info(TAG, value);
1681 } else if (opt_elementOrExpr.nodeType == Node.ELEMENT_NODE) {
1682 const element = user().assertElement(opt_elementOrExpr);
1683 this.debugPrintElement_(element);
1684 } else {
1685 user().info(
1686 TAG,
1687 'Invalid argument. Pass a JSON expression or an ' +
1688 'element instead e.g. AMP.printState("foo.bar") or ' +
1689 'AMP.printState($0) after selecting an element.'
1690 );
1691 }
1692 } else {
1693 user().info(TAG, this.state_);
1694 }
1695 }
1696
1697 /**
1698 * Print out the element's bound attributes and respective expression values.

Callers

nothing calls this directly

Calls 5

debugPrintElement_Method · 0.95
getValueForExprFunction · 0.90
userFunction · 0.90
infoMethod · 0.80
assertElementMethod · 0.80

Tested by

no test coverage detected