Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

134
Views
enviar notificaciones desde el trabajador del servicio

Tengo una aplicación pwa que básicamente es un formulario simple. Si la red está fuera de línea, se guarda en el almacenamiento local (indexedDB) y luego se envía cuando la conexión está en línea. Hasta aquí todo está bien, pero me gustaría mostrarle un mensaje al usuario 'el formulario fue enviado al servidor' y no puedo hacerlo funcionar. Uso la propiedad 'SYNC' para hacer esta función. En mi trabajador de servicio, la parte del código relativa a esta característica es:

 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); } });

¿Qué podría estar mal?, en el lado de javascript, se verifica que Notification.permission === 'concedido'.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!