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

81
Views
Transmitir información al trabajador de servicio en la instalación

Tengo un PWA con varios idiomas diferentes y me gustaría almacenar en caché solo los archivos específicos del idioma en la instalación. No puedo encontrar una manera de comunicar el idioma al trabajador del servicio durante la instalación. ¿Ideas de cómo podría hacerlo?

Mi código js para iniciar el trabajador del servicio:

 navigator.serviceWorker.register('../service-worker.js', { scope: '/' }).then((reg) => { console.log('Service worker registered successfully.', reg); registration = reg; }).catch(function (e) { console.error('Error during service worker registration:', e); });

Mi código en el service-worker.js:

 self.addEventListener('install', function(event) { messageAllClients('Event-Install'); // Perform install steps event.waitUntil( caches.open(CACHE_NAME).then(function(cache) { messageAllClients('Language detected by the service worker: '+language); messageAllClients('Pre-caching offline page'); return cache.addAll(FILES_TO_CACHE); }) ); self.skipWaiting(); });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Las variables se pueden transmitir al trabajador del servicio durante la instalación a través de los atributos GET , como señaló @JeffPosnick en el comentario.

about 4 years ago · Juan Pablo Isaza Report
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!