MCPcopy Index your code
hub / github.com/angular/angular / cacheState

Method cacheState

packages/common/upgrade/src/location_shim.ts:318–332  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

316 // This variable should be used *only* inside the cacheState function.
317 private lastCachedState: unknown = null;
318 private cacheState() {
319 // This should be the only place in $browser where `history.state` is read.
320 this.cachedState = this.platformLocation.getState();
321 if (typeof this.cachedState === 'undefined') {
322 this.cachedState = null;
323 }
324
325 // Prevent callbacks fo fire twice if both hashchange & popstate were fired.
326 if (deepEqual(this.cachedState, this.lastCachedState)) {
327 this.cachedState = this.lastCachedState;
328 }
329
330 this.lastCachedState = this.cachedState;
331 this.lastHistoryState = this.cachedState;
332 }
333
334 /**
335 * This function emulates the $browser.state() function from AngularJS. It will cause

Callers 2

constructorMethod · 0.95
browserUrlMethod · 0.95

Calls 2

deepEqualFunction · 0.90
getStateMethod · 0.45

Tested by

no test coverage detected