Browse Source

Update Function

master
JonatanRek 1 year ago
parent
commit
d34dde916e
5 changed files with 28 additions and 22 deletions
  1. +9
    -5
      node_modules/websocket-driver/package.json
  2. +5
    -3
      src/components/UpdateBar.vue
  3. +1
    -1
      src/main.js
  4. +7
    -7
      src/registerServiceWorker.js
  5. +6
    -6
      src/service-worker.js

+ 9
- 5
node_modules/websocket-driver/package.json View File

@ -1,4 +1,11 @@
{
"_args": [
[
"websocket-driver@0.6.5",
"C:\\Users\\ASUS-ROG-NTB\\Disk Google\\git\\VUE_GabenParadise"
]
],
"_development": true,
"_from": "websocket-driver@0.6.5",
"_id": "websocket-driver@0.6.5",
"_inBundle": false,
@ -21,9 +28,8 @@
"/sockjs-client/faye-websocket"
],
"_resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.6.5.tgz",
"_shasum": "5cb2556ceb85f4373c6d8238aa691c8454e13a36",
"_spec": "websocket-driver@0.6.5",
"_where": "C:\\Users\\ASUS-ROG-NTB\\Disk Google\\git\\freeGames\\gabenparadise\\node_modules\\sockjs",
"_spec": "0.6.5",
"_where": "C:\\Users\\ASUS-ROG-NTB\\Disk Google\\git\\VUE_GabenParadise",
"author": {
"name": "James Coglan",
"email": "jcoglan@gmail.com",
@ -32,11 +38,9 @@
"bugs": {
"url": "https://github.com/faye/websocket-driver-node/issues"
},
"bundleDependencies": false,
"dependencies": {
"websocket-extensions": ">=0.1.1"
},
"deprecated": false,
"description": "WebSocket protocol handler with pluggable I/O",
"devDependencies": {
"jstest": "",

+ 5
- 3
src/components/UpdateBar.vue View File

@ -3,7 +3,9 @@
<div v-if="once">
<div class="alert alert-danger" role="alert">
Update Awailible
<button type="button" class="btn btn-primary" v-on:click="refreshApp">Refresh</button>
<button type="button" class="btn btn-primary" v-on:click="refreshApp">
Refresh
</button>
</div>
</div>
</template>
@ -27,7 +29,7 @@ export default {
this.updateAvailable(event);
this.once = true;
});
navigator.serviceWorker.addEventListener("controllerchange", () => {
if (this.refreshing) return;
this.refreshing = true;
@ -46,4 +48,4 @@ export default {
}
}
};
</script>
</script>

+ 1
- 1
src/main.js View File

@ -6,4 +6,4 @@ Vue.config.productionTip = false;
new Vue({
render: h => h(App)
}).$mount("#app");
}).$mount("#app");

+ 7
- 7
src/registerServiceWorker.js View File

@ -27,10 +27,10 @@ if (process.env.NODE_ENV === "production") {
ready() {
console.log(
"App is being served from cache by a service worker.\n" +
"For more details, visit https://goo.gl/AFskqB"
"For more details, visit https://goo.gl/AFskqB"
);
Notification.requestPermission(function (status) {
Notification.requestPermission(function(status) {
console.log("Status ", status);
if (status === "granted" && startPermission !== "granted") {
window.location.reload();
@ -50,8 +50,8 @@ if (process.env.NODE_ENV === "production") {
updated(registration) {
console.log("New content is available; please refresh.");
document.dispatchEvent(
new CustomEvent('swUpdated';, { detail: registration })
)
new CustomEvent("swUpdated";, { detail: registration })
);
},
offline() {
console.log(
@ -76,7 +76,7 @@ function subscribeFirebase($registration) {
"BEbiSQ7ishlWlO7v-_EJW3iFk6WmgdSFrPgfXsjLNflqljBqWEZwv-4iyaTaYYE1VM2y1fX9V50QoZ0c8ft5C0s"
);
messaging.getToken().then(function (token) {
messaging.getToken().then(function(token) {
console.log("Token: ", token);
console.log(JSON.stringify({ token: token }));
//FIX: New URL
@ -92,10 +92,10 @@ function subscribeFirebase($registration) {
}
}
)
.then(function (response) {
.then(function(response) {
console.log(response);
})
.catch(function (error) {
.catch(function(error) {
console.log(error);
});
});

+ 6
- 6
src/service-worker.js View File

@ -2,7 +2,7 @@
// debug: true
// });
self.addEventListener("push", function (event) {
self.addEventListener("push", function(event) {
if (event.data) {
var data = event.data.json();
var notOptions = {
@ -21,7 +21,7 @@ self.addEventListener("push", function (event) {
}
});
self.addEventListener("notificationclick", function (event) {
self.addEventListener("notificationclick", function(event) {
if (event.notification) {
if (data.data) {
var data = JSON.parse(event.notification.data.data);
@ -35,11 +35,11 @@ self.addEventListener("notificationclick", function (event) {
clients.openWindow("/");
});
self.addEventListener('message', (event) => {
if (event.data && event.data.type === 'SKIP_WAITING';) {
self.skipWaiting()
self.addEventListener("message", event => {
if (event.data && event.data.type === "SKIP_WAITING";) {
self.skipWaiting();
}
})
});
self.__precacheManifest = [].concat(self.__precacheManifest || []);
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});

Loading…
Cancel
Save