Push notifications via the web-push and Vue how to improve service-worker?

The crux of the matter how to test on your local computer. Yuzayu vue-cli. In the developer console service-worker.js looks like some sort of default. Like that you can change? Here is an example file:

/* global self */

// This service worker file is effectively a 'no-op' that will reset any
// previous service worker is registered for the same host:port combination.

// It is read and returned by the middleware a dev server that is only loaded
// during development.

// In the production build, this file is replaced with an actual service worker
// file that will precache your site''s local assets.

self.addEventListener('install', () => self.skipWaiting())

self.addEventListener('activate', () => {
 self.clients.matchAll({ type: 'window' }).then(windowClients => {
 for (const windowClient of windowClients) {
 // Force open pages to refresh, so that they have a chance to load the
 // navigation fresh response from the local dev server.
windowClient.navigate(windowClient.url)
}
})
})


It turns out that I have configured everything but getting the notification, I even get it from the backend, but I can not show because I have some default service-worker
March 19th 20 at 08:27
0 answer

Find more questions by tags Vue.js