| ... |
... |
@@ -1,16 +1,10 @@ |
| 1 |
|
-self.addEventListener('fetch', function(event) { |
| 2 |
|
-console.log('sw', event); |
| 3 |
|
-/* |
| 4 |
|
- event.respondWith( |
| 5 |
|
- fetch(event.request).then(function(response) { |
| 6 |
|
- if (response.status === 404) { |
| 7 |
|
- return fetch("/path/to/404error.gif"); |
| 8 |
|
- } |
| 9 |
|
- return response; |
| 10 |
|
- }).catch(function() { |
| 11 |
|
- return new Response("Uh oh, that totally failed!"); |
| 12 |
|
- }) |
| 13 |
|
- ); |
| 14 |
|
-*/ |
| 15 |
|
-}); |
| 16 |
|
- |
|
1 |
+if ('serviceWorker' in navigator) { |
|
2 |
+ navigator.serviceWorker.register('/bin/get/LiveTableServiceWorker?xcontent=plain&outputSyntax=plain', { 'scope': '/bin/view/Membership'}) |
|
3 |
+ .then((reg) => { |
|
4 |
+ // registration worked |
|
5 |
+ console.log('Registration succeeded. Scope is ' + reg.scope); |
|
6 |
+ }).catch((error) => { |
|
7 |
+ // registration failed |
|
8 |
+ console.log('Registration failed with ' + error); |
|
9 |
+ }); |
|
10 |
+} |