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

Method getStateValue

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

* Returns the stringified value of the global state for a given field-based * expression, e.g. "foo.bar.baz". * @param {string} expr * @return {?string}

(expr)

Source from the content-addressed store, hash-verified

568 * @return {?string}
569 */
570 getStateValue(expr) {
571 const value = getValueForExpr(this.state_, expr);
572 if (value === undefined || value === null) {
573 return null;
574 } else if (isObject(value) || isArray(value)) {
575 return JSON.stringify(/** @type {JsonObject} */ (value));
576 } else {
577 return String(value);
578 }
579 }
580
581 /**
582 * Scans the root node (and array of optional nodes) for bindings.

Callers 2

initializeMethod · 0.80
getStorageMethod · 0.80

Calls 5

getValueForExprFunction · 0.90
isObjectFunction · 0.90
isArrayFunction · 0.85
stringifyMethod · 0.80
StringFunction · 0.50

Tested by

no test coverage detected