翻译正在进行中。

原生平台一个主要优势是,用户可以轻松通过更新或加载新内容,即使用户没有正在查看应用程序或者使用他们的设备。现在的Web应用程序现在也可以使用Web Push API等技术实现这样的功能。

核心指南

Using service workers
A simple guide for those new to the Service Worker API.
Using the Push API
Learn the essentials behind the Web Push API.
Using the Notifications API
Web notifications in a nutshell.

技术

技术 描述 浏览器支持 最新规范
Service workers JavaScript running in a special worker context that is run by the browser under certain circumstances such as fetch or push events. These allow the service worker to intercept responses and customise them in any way you want, for example caching assets for offline use before they are served. Experimental: Chrome and Firefox (more detail) Service Workers
Push API When subscribed to, the push service provides an endpoint that can be used by a server to send a push message to a web app under the control of a particular service worker. Experimental: chrome and Firefox (more detail) Push API
Notifications API Fires system notifications directly from web applications. Widespreadin modern browsers (more detail) Notifications API

工具

ServiceWorkerWare
An Express-like microframework for easy Service Worker development.
oghliner
Not only a template but a tool for deploying Offline Web Apps to GitHub Pages.
sw-precache
A node module to generate service worker code that will precache specific resources.

参见

The service worker cookbook
A series of excellent service worker recipes, showing how to implement an offline app, but also much more.

文档标签和贡献者

 此页面的贡献者: liminjun
 最后编辑者: liminjun,