Safari is stupid
This commit is contained in:
@@ -12,13 +12,17 @@ var serviceWorkerRegistrationMixin = {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
registerPushListener: function() {
|
registerPushListener: function() {
|
||||||
const channel = new BroadcastChannel("updatePush");
|
try {
|
||||||
channel.addEventListener("message", event => {
|
const channel = new BroadcastChannel("updatePush");
|
||||||
if (event.data.success) {
|
channel.addEventListener("message", event => {
|
||||||
localStorage.setItem("push", true);
|
if (event.data.success) {
|
||||||
this.$emit("push-allowed");
|
localStorage.setItem("push", true);
|
||||||
}
|
this.$emit("push-allowed");
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.log("Using safari 'eh? No notifications for you.");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
sendMessage: function(message) {
|
sendMessage: function(message) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
|
|||||||
@@ -25,8 +25,12 @@ self.addEventListener("message", event => {
|
|||||||
.then(subscription =>
|
.then(subscription =>
|
||||||
saveSubscription(subscription)
|
saveSubscription(subscription)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const channel = new BroadcastChannel("updatePush");
|
try {
|
||||||
channel.postMessage({ success: true });
|
const channel = new BroadcastChannel("updatePush");
|
||||||
|
channel.postMessage({ success: true });
|
||||||
|
} catch (e) {
|
||||||
|
console.log("Using safari 'eh? No notifications for you.");
|
||||||
|
}
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user