web-manager 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +10 -2
- package/package.json +1 -1
package/index.js
CHANGED
@@ -1082,7 +1082,8 @@ function Manager() {
|
|
1082
1082
|
dateSubscribed: {
|
1083
1083
|
timestamp: timestamp,
|
1084
1084
|
timestampUNIX: timestampUNIX
|
1085
|
-
}
|
1085
|
+
},
|
1086
|
+
url: window.location.href,
|
1086
1087
|
},
|
1087
1088
|
token: token,
|
1088
1089
|
link: {
|
@@ -1164,6 +1165,7 @@ function Manager() {
|
|
1164
1165
|
navigator.serviceWorker.register('/' + (options_user.serviceWorker.path || 'master-service-worker.js') + '?config=' + encodeURIComponent(JSON.stringify({name: This.properties.global.brand.name, env: This.properties.meta.environment, v: This.properties.global.version, firebase: options_user.libraries.firebase_app.config})) )
|
1165
1166
|
.then(function (registration) {
|
1166
1167
|
// firebase.messaging().useServiceWorker(registration);
|
1168
|
+
// console.log('----TEST registration', registration);
|
1167
1169
|
This.properties.references.serviceWorker = registration;
|
1168
1170
|
// console.log('====registration', registration);
|
1169
1171
|
// console.log('navigator.serviceWorker.controller', navigator.serviceWorker.controller);
|
@@ -1221,8 +1223,14 @@ function Manager() {
|
|
1221
1223
|
try {
|
1222
1224
|
// Normally, notifications are not displayed when user is ON PAGE but we will display it here anyway
|
1223
1225
|
firebase.messaging().onMessage(function (payload) {
|
1224
|
-
|
1226
|
+
// console.log('---payload', payload);
|
1227
|
+
new Notification(payload.notification.title, payload.notification)
|
1228
|
+
.onclick = function(event) {
|
1229
|
+
event.preventDefault(); // prevent the browser from focusing the Notification's tab
|
1230
|
+
window.open(payload.notification.click_action, '_blank');
|
1231
|
+
}
|
1225
1232
|
})
|
1233
|
+
// console.log('---SKIPPING ONMESSAGE');
|
1226
1234
|
} catch (e) {
|
1227
1235
|
console.error(e);
|
1228
1236
|
}
|
package/package.json
CHANGED