Skip to content

Commit

Permalink
update app yaml add fake worker
Browse files Browse the repository at this point in the history
  • Loading branch information
Filip Procházka committed Feb 2, 2017
1 parent 9cef40e commit ed74b16
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
runtime: go
version: 1
api_version: go1
threadsafe: true

skip_files:
- ^node_modules$
- ^\.idea$

handlers:
- url: /service-worker.js

static_files: public/service-worker.js
upload: public/service-worker.js
secure: always

- url: /.*
script: _go_app
10 changes: 10 additions & 0 deletions public/service-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
self.addEventListener('install', function (event) {
event.waitUntil(self.skipWaiting())
});

self.addEventListener('activate', function (event) {
// `claim()` sets this worker as the active worker for all clients that
// match the workers scope and triggers an `oncontrollerchange` event for
// the clients.
return self.clients.claim();
});

0 comments on commit ed74b16

Please sign in to comment.