可以安装http-server来本地启动服务:
npm install http-server -g
然后在Notification目录下执行 http-server
一个express简陋的服务,PushServer目录下执行 node src/app.js
启动项目。
如果你成功运行,那么每过10s,会在屏幕出现提示信息, 22333。
https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle
https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook
https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Add_to_home_screen
注意webmanifest配置里的图片格式一定是png,否则就不会被浏览器识别
{
"background_color": "purple",
"description": "Shows random fox pictures. Hey, at least it isn't cats.",
"display": "fullscreen",
"icons": [
{
"src": "./icon.png",
"sizes": "192x192",
"type": "image/png"
}
],
"name": "Awesome fox pictures",
"short_name": "Foxes",
"start_url": "index.html"
}
https://developers.google.com/web/fundamentals/push-notifications
https://developers.google.com/web/tools/workbox/ http://csbun.github.io/blog/2018/02/workbox/
https://www.chromium.org/blink/serviceworker/service-worker-faq
https://www.youtube.com/watch?v=Di7RvMlk9io&feature=emb_rel_pause https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Installable_PWAs
https://developers.google.com/web/updates/2016/05/houdini https://www.smashingmagazine.com/2020/03/practical-overview-css-houdini/