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