diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-08-31 23:07:20 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-08-31 23:07:20 +0200 |
| commit | 22721a013bdd10d5eb395ba18453585f5f3f1f7f (patch) | |
| tree | 5a920e31d6026ed5dc55265e5fd057febccc50e3 /StoneIsland/plugins/phonegap-plugin-push/src/browser/ServiceWorker.js | |
| parent | d22d51a1ae49680015326857360eb699f31efced (diff) | |
rebuild the ios platform and the plugins
Diffstat (limited to 'StoneIsland/plugins/phonegap-plugin-push/src/browser/ServiceWorker.js')
| -rw-r--r-- | StoneIsland/plugins/phonegap-plugin-push/src/browser/ServiceWorker.js | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/StoneIsland/plugins/phonegap-plugin-push/src/browser/ServiceWorker.js b/StoneIsland/plugins/phonegap-plugin-push/src/browser/ServiceWorker.js deleted file mode 100644 index 0fc06d09..00000000 --- a/StoneIsland/plugins/phonegap-plugin-push/src/browser/ServiceWorker.js +++ /dev/null @@ -1,51 +0,0 @@ -var messageChannel; - -self.addEventListener('install', function(event) { - self.skipWaiting(); -}); - -self.addEventListener('push', function(event) { - // parse incoming message - var obj = {}; - var pushData = { - image: 'https://avatars1.githubusercontent.com/u/60365?v=3&s=200', - additionalData: {} - }; - if (event.data) { - obj = event.data.json(); - } - - console.log(obj); - - // convert to push plugin API - for (var key in obj) { - if (key === 'title') { - pushData.title = obj[key]; - } else if (key === 'message' || key === 'body') { - pushData.message = obj[key]; - } else if (key === 'count' || key === 'msgcnt' || key === 'badge') { - pushData.count = obj[key]; - } else if (key === 'sound' || key === 'soundname') { - pushData.sound = obj[key]; - } else if (key === 'image') { - pushData.image = obj[key]; - } else { - pushData.additionalData[key] = obj[key]; - } - } - - event.waitUntil( - self.registration.showNotification(pushData.title, { - body: pushData.message, - icon: pushData.image, - tag: 'simple-push-demo-notification-tag' - }) - ); - - messageChannel.ports[0].postMessage(pushData); - -}); - -self.addEventListener('message', function(event) { - messageChannel = event; -}); |
