|
1 | 1 | /* eslint no-console:0 */ |
2 | 2 |
|
3 | | -import { Workbox } from 'https://storage.googleapis.com/workbox-cdn/releases/4.0.0/workbox-window.prod.mjs'; |
| 3 | +import {Workbox} from 'https://storage.googleapis.com/workbox-cdn/releases/4.0.0/workbox-window.prod.mjs'; |
4 | 4 |
|
5 | 5 | function serverReady() { |
6 | | - console.log('Server ready! use `window.Filer.fs if you need an fs'); |
| 6 | + console.log('Server ready! use `window.Filer.fs if you need an fs'); |
7 | 7 | } |
8 | 8 |
|
9 | 9 | function serverInstall() { |
10 | | - console.log('Server installed for first time'); |
| 10 | + console.log('Server installed for first time'); |
11 | 11 |
|
12 | | - const fs = window.Filer.fs; |
13 | | - fs.writeFile('/The Bridge.txt', 'hello world!', function(err) { |
14 | | - if(err) console.error(err); |
15 | | - }); |
| 12 | + const fs = window.Filer.fs; |
| 13 | + fs.writeFile('/The Bridge.txt', 'hello world!', function (err) { |
| 14 | + if (err) console.error(err); |
| 15 | + }); |
16 | 16 | } |
17 | 17 |
|
18 | 18 | /** |
19 | 19 | * Register the nohost service worker, passing `route` or other options. |
20 | 20 | */ |
21 | 21 | if ('serviceWorker' in navigator) { |
22 | | - const wb = new Workbox('/nohost-sw.js?debug'); |
| 22 | + const wb = new Workbox('/nohost-sw.js?debug'); |
23 | 23 |
|
24 | | - // Wait on the server to be fully ready to handle routing requests |
25 | | - wb.controlling.then(serverReady); |
| 24 | + // Wait on the server to be fully ready to handle routing requests |
| 25 | + wb.controlling.then(serverReady); |
26 | 26 |
|
27 | | - // Deal with first-run install, if necessary |
28 | | - wb.addEventListener('installed', (event) => { |
29 | | - if(!event.isUpdate) { |
30 | | - serverInstall(); |
31 | | - } |
32 | | - }); |
| 27 | + // Deal with first-run install, if necessary |
| 28 | + wb.addEventListener('installed', (event) => { |
| 29 | + if (!event.isUpdate) { |
| 30 | + serverInstall(); |
| 31 | + } |
| 32 | + }); |
33 | 33 |
|
34 | | - wb.register(); |
| 34 | + wb.register(); |
35 | 35 | } |
0 commit comments