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

Method setStateAndUpdateHistory_

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

* Merges a state object into the current global state. * @param {!JsonObject} state * @return {!Promise} * @private

(state)

Source from the content-addressed store, hash-verified

351 * @private
352 */
353 setStateAndUpdateHistory_(state) {
354 dev().info(TAG, 'setState:', state);
355 this.setStatePromise_ = this.setState(state)
356 .then(() => this.getDataForHistory_())
357 .then((data) => {
358 // Don't bother calling History.replace with empty data.
359 if (data) {
360 this.history_.replace(data);
361 }
362 });
363 return this.setStatePromise_;
364 }
365
366 /**
367 * Same as setStateWithExpression() except also pushes new history.

Callers 2

setStateWithObjectMethod · 0.95

Calls 6

setStateMethod · 0.95
getDataForHistory_Method · 0.95
devFunction · 0.90
infoMethod · 0.80
thenMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected