()
| 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 |
no test coverage detected