(ignoreOfflineError = false)
| 929 | private async fetchLatestManifest(ignoreOfflineError?: false): Promise<Manifest>; |
| 930 | private async fetchLatestManifest(ignoreOfflineError: true): Promise<Manifest | null>; |
| 931 | private async fetchLatestManifest(ignoreOfflineError = false): Promise<Manifest | null> { |
| 932 | const res = await this.safeFetch( |
| 933 | this.adapter.newRequest('ngsw.json?ngsw-cache-bust=' + Math.random()), |
| 934 | ); |
| 935 | if (!res.ok) { |
| 936 | if (res.status === 404) { |
| 937 | await this.deleteAllCaches(); |
| 938 | await this.scope.registration.unregister(); |
| 939 | } else if ((res.status === 503 || res.status === 504) && ignoreOfflineError) { |
| 940 | return null; |
| 941 | } |
| 942 | throw new Error(`Manifest fetch failed! (status: ${res.status})`); |
| 943 | } |
| 944 | this.lastUpdateCheck = this.adapter.time; |
| 945 | return res.json(); |
| 946 | } |
| 947 | |
| 948 | private async deleteAllCaches(): Promise<void> { |
| 949 | const cacheNames = await this.adapter.caches.keys(); |
no test coverage detected