Skip to content

Commit

Permalink
Log service worker events and add extension API when SW updates
Browse files Browse the repository at this point in the history
e.g. you could use this extension API to show the user that an update is
available and they should update.
  • Loading branch information
KyleAMathews committed Nov 1, 2016
1 parent 625b871 commit 5173bdc
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/intermediate-representation-dir/production-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,22 @@ try {

// Install service worker.
runtime.install({
onInstalled () {
console.log(`App is ready for offline usage`)
onInstalled: () => {
console.log("SW Event:", "onInstalled")
},
onUpdating: () => {
console.log("SW Event:", "onUpdating")
},
onUpdateReady: () => {
console.log("SW Event:", "onUpdateReady")
runtime.applyUpdate()
},
onUpdated: () => {
console.log("SW Event:", "onUpdated")
apiRunner('swOnUpdated')
},
onUninstalled: () => {
console.log("SW Event:", "onUninstalled")
},
})

Expand Down

0 comments on commit 5173bdc

Please sign in to comment.