ServiceWorker 和 Workbox 有什么区别?

What is the differences between ServiceWorker and Workbox?

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

但我仍然不知道它是什么。这是一个帮助我更轻松地制作 SW 的库吗?或者,这是另一种无需软件即可制作 PWA 的方法吗?

"Workbox"的准确定义是什么?

这是一个与 Service Worker 一起工作的库。但不仅是 Service Worker,还有其他考虑 Progressive Web Apps 的东西,例如 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

这个定义很好

Workbox 将:

  • 在您手动(手动)编写 Service Worker 时帮助您使用库提供的实用程序
  • 获取配置并为您生成 Service Worker