Loading...
18 |
19 |
20 | An unhandled error has occurred.
21 |
Reload
22 |
🗙
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/samples/GitStatus.Web/wwwroot/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "GitStatus.Web",
3 | "short_name": "GitStatus.Web",
4 | "start_url": "./",
5 | "display": "standalone",
6 | "background_color": "#ffffff",
7 | "theme_color": "#03173d",
8 | "icons": [
9 | {
10 | "src": "icon-512.png",
11 | "type": "image/png",
12 | "sizes": "512x512"
13 | }
14 | ]
15 | }
16 |
--------------------------------------------------------------------------------
/samples/GitStatus.Web/wwwroot/sample-data/weather.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "date": "2018-05-06",
4 | "temperatureC": 1,
5 | "summary": "Freezing"
6 | },
7 | {
8 | "date": "2018-05-07",
9 | "temperatureC": 14,
10 | "summary": "Bracing"
11 | },
12 | {
13 | "date": "2018-05-08",
14 | "temperatureC": -13,
15 | "summary": "Freezing"
16 | },
17 | {
18 | "date": "2018-05-09",
19 | "temperatureC": -16,
20 | "summary": "Balmy"
21 | },
22 | {
23 | "date": "2018-05-10",
24 | "temperatureC": -2,
25 | "summary": "Chilly"
26 | }
27 | ]
28 |
--------------------------------------------------------------------------------
/samples/GitStatus.Web/wwwroot/service-worker.js:
--------------------------------------------------------------------------------
1 | // In development, always fetch from the network and do not enable offline support.
2 | // This is because caching would make development more difficult (changes would not
3 | // be reflected on the first load after each change).
4 | self.addEventListener('fetch', () => { });
5 |
--------------------------------------------------------------------------------
/samples/GitStatus.Web/wwwroot/service-worker.published.js:
--------------------------------------------------------------------------------
1 | // Caution! Be sure you understand the caveats before publishing an application with
2 | // offline support. See https://aka.ms/blazor-offline-considerations
3 |
4 | self.importScripts('./service-worker-assets.js');
5 | self.addEventListener('install', event => event.waitUntil(onInstall(event)));
6 | self.addEventListener('activate', event => event.waitUntil(onActivate(event)));
7 | self.addEventListener('fetch', event => event.respondWith(onFetch(event)));
8 |
9 | const cacheNamePrefix = 'offline-cache-';
10 | const cacheName = `${cacheNamePrefix}${self.assetsManifest.version}`;
11 | const offlineAssetsInclude = [ /\.dll$/, /\.pdb$/, /\.wasm/, /\.html/, /\.js$/, /\.json$/, /\.css$/, /\.woff$/, /\.png$/, /\.jpe?g$/, /\.gif$/, /\.ico$/, /\.blat$/, /\.dat$/ ];
12 | const offlineAssetsExclude = [ /^service-worker\.js$/ ];
13 |
14 | async function onInstall(event) {
15 | console.info('Service worker: Install');
16 |
17 | // Fetch and cache all matching items from the assets manifest
18 | const assetsRequests = self.assetsManifest.assets
19 | .filter(asset => offlineAssetsInclude.some(pattern => pattern.test(asset.url)))
20 | .filter(asset => !offlineAssetsExclude.some(pattern => pattern.test(asset.url)))
21 | .map(asset => new Request(asset.url, { integrity: asset.hash }));
22 | await caches.open(cacheName).then(cache => cache.addAll(assetsRequests));
23 | }
24 |
25 | async function onActivate(event) {
26 | console.info('Service worker: Activate');
27 |
28 | // Delete unused caches
29 | const cacheKeys = await caches.keys();
30 | await Promise.all(cacheKeys
31 | .filter(key => key.startsWith(cacheNamePrefix) && key !== cacheName)
32 | .map(key => caches.delete(key)));
33 | }
34 |
35 | async function onFetch(event) {
36 | let cachedResponse = null;
37 | if (event.request.method === 'GET') {
38 | // For all navigation requests, try to serve index.html from cache
39 | // If you need some URLs to be server-rendered, edit the following check to exclude those URLs
40 | const shouldServeIndexHtml = event.request.mode === 'navigate';
41 |
42 | const request = shouldServeIndexHtml ? 'index.html' : event.request;
43 | const cache = await caches.open(cacheName);
44 | cachedResponse = await cache.match(request);
45 | }
46 |
47 | return cachedResponse || fetch(event.request);
48 | }
49 |
--------------------------------------------------------------------------------
/src/GitHubApiStatus.Extensions.UnitTests/GitHubApiStatus.Extensions.UnitTests.csproj:
--------------------------------------------------------------------------------
1 |