Google Chrome Developers765 тыс
Опубликовано 2 апреля 2024, 16:00
Service workers are a powerful tool for allowing websites to work offline and to create caching strategies that can provide a performance boost.
However, there can be a performance cost when a page is loaded for the first time in a while and the controlling service worker isn't currently running. Since all fetches need to happen through the service worker, the browser has to wait for the service worker to start up and run to know what content to load.
With the Service Workers Static Routing API, at install time, you can declare paths to always be served from the network. When a controlled URL is later loaded, the browser can start fetching resources from those paths before the service worker has finished starting. This removes the service worker from the paths that you know don't need a service worker.
Speaker: Adriana Jara
However, there can be a performance cost when a page is loaded for the first time in a while and the controlling service worker isn't currently running. Since all fetches need to happen through the service worker, the browser has to wait for the service worker to start up and run to know what content to load.
With the Service Workers Static Routing API, at install time, you can declare paths to always be served from the network. When a controlled URL is later loaded, the browser can start fetching resources from those paths before the service worker has finished starting. This removes the service worker from the paths that you know don't need a service worker.
Speaker: Adriana Jara
Свежие видео
Случайные видео