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

Method getState

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

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

(expr)

Source from the content-addressed store, hash-verified

527 * @return {*}
528 */
529 getState(expr) {
530 const value = expr ? getValueForExpr(this.state_, expr) : undefined;
531 if (isObject(value) || isArray(value)) {
532 return this.copyJsonObject_(/** @type {JsonObject} */ (value));
533 }
534 return value;
535 }
536
537 /**
538 * Returns a copy of the global state for an expression, after waiting for its

Callers 3

getStateAsyncMethod · 0.95
mraidLoadSuccess_Method · 0.45
onBindReadyAndGetStateFunction · 0.45

Calls 4

copyJsonObject_Method · 0.95
getValueForExprFunction · 0.90
isObjectFunction · 0.90
isArrayFunction · 0.85

Tested by

no test coverage detected