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

145
Views
Trying to set up service worker for caching, it never installs

So, I am trying to build a PWA and I am just getting familiar with caching/service workers. I found some examples online that all seem to be the same, and I am trying to cache a few of my routes. However, it simply doesn't do anything.

const staticCache = "myApp";

const assets = [
    "/",
    "/session",
    "/login",
    "/logout",
    "/register",
    "/account/create",
    "/accounts/balance",
    "/categories/new",
];

self.addEventListener("install", (event)=>{
    console.log("installed");
    event.waitUntil(
        caches.open(staticCache)
            .then((cache)=>{
                return cache.addAll(assets);
            })
    )
});

When this runs, the "installed" is never printed. So it never installs, nothing happens. Am I missing something here? Did I miss a step? Thanks in advance.

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!