ServiceWorker 和 Workbox 有什么区别?

Roe*_*iss 2 service-worker workbox

我是 ServiceWorker 的初学者。今天我看到这个网站: https: //developers.google.com/web/tools/workbox

但我还是不知道那是什么。这是一个可以帮助我以更简单的方式制作软件的库吗?或者,这是在没有软件的情况下制作 PWA 的另一种方法吗?

“Workbox”的准确定义是什么?

pat*_*ate 6

它是一个与 Service Workers 一起工作的库。但不仅是 Service Worker,还包括考虑渐进式 Web 应用程序的其他事物,例如 manifest.json 文件。

您链接的页面说:

Why Workbox?
Workbox is a library that bakes in a set of best practices and removes the boilerplate every developer writes when working with service workers.

Precaching
Runtime caching
Strategies
Request routing
Background sync
Helpful debugging
Greater flexibility and feature set than sw-precache and sw-toolbox
Run Code Online (Sandbox Code Playgroud)

这是一个很好的定义。

Workbox 将:

  • 当您手动编写 Service Worker 时,可以帮助您使用库提供的实用程序
  • 接受配置并为您生成 Service Worker