Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

318
Vistas
VueJS FCM - how to stop receiving notifications when user closes browser

We have the current scenario where user continues to receive notifications from the site even after closing the browser. Please let us know how to address it, appreciate your help.

if ("serviceWorker" in navigator) {
navigator.serviceWorker
    .register("./firebase-messaging-sw.js")
    .then(function (registration) {
    const mregn = registration;
    page.messaging = firebase.messaging();
    page.messaging
        .requestPermission()
        .then(function () {
        // get the token in the form of promise
        return page.messaging.getToken(
            { serviceWorkerRegistration: mregn }
        );
        })
        .then(function (token) {
        })
        .catch(function (err) {
        });
    })
    .catch(function (err) {
    console.log("Registration failed, error:", err);
    });
}

This is what we tried to unregister but not working

beforeDestroy: function () {
    if ("serviceWorker" in navigator) {
        navigator.serviceWorker
            .unregister()
            .then(function (status) {
            });
    }
},
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda