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

128
Vistas
sending notifications from service worker

I have a pwa app that basically is a simple form. If the network is offline, it is saved to local storage(indexedDB) and send afterwards when the connection is online. Up to here everything is ok, but I would like to show a message to the user 'the form was sent to the server' and I can't get it working. I use the property 'SYNC' for doing this feature. In my service worker the part of the code relative to this feature is:

self.addEventListener('sync', e => {
    console.log('SW: Sync');
    if ( e.tag === 'new-form' ) {

        // send to DB when onLine
        const resp = sendForm(); //up to here all is OK.

        self.registration.showNotification(' Succesfully send to MongoDB');// this line is not working

        e.waitUntil( resp);
    }
}); 

What could be wrong?, in javascript side, It is verified that Notification.permission === 'granted'.

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