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

118
Views
¿Cómo agrego enlaces de activos al trabajador de servicio de Workbox?

Estoy tratando de agregar enlaces a mis activos en el trabajador del servicio de caja de trabajo para almacenar en caché. Y quiero que se carguen desde el caché y luego busquen en la red. Soy nuevo en Workbox, así que no sé qué hacer. Por favor ayuda. Aquí está el código de la caja de trabajo.

 importScripts('/local-res/comps/wb-ox-sw.js'); 'use strict'; var cacheVersion = 1, currentCache = { offline: 'OFFSERVE' + cacheVersion }, offlineUrl = '/mes_srv_off.html'; this.addEventListener('install', event => { event.waitUntil( caches.open(currentCache.offline).then(function(cache) { return cache.addAll([ offlineUrl ]); }) ); }); this.addEventListener('fetch', event => { if (event.request.mode === 'navigate' || (event.request.method === 'GET' && event.request.headers.get('accept').includes('text/html'))) { event.respondWith( fetch(event.request.url).catch(error => { return caches.match(offlineUrl); }) ); } else{ event.respondWith(caches.match(event.request) .then(function (response) { return response || fetch(event.request); }) ); } }); workbox.routing.registerRoute( ({request}) => request.destination === 'image', new workbox.strategies.CacheFirst() ); workbox.routing.registerRoute( ({request}) => request.destination === 'style' || request.destination === 'script', new workbox.strategies.CacheFirst() );
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!