Repository navigation
PWA Reference
- Progressive Web Apps
- Building Progressive Web Apps Today (Chrome Dev Summit 2016)
- Build the Next Generation Mobile
- Instant Loading: Building offline-first Progressive Web Apps - Google I/O 2016
- outweb(依照網站性質分類)
- pwa.rock(依照網站性質分類)
- PWA Directory(可以依照網站評分排行)
- PWA Stats(列出網站使用 PWA 所帶來的成效)
- Lighthouse (由 Google 工程師所開發)
- Can I use Service Workers?
- is Service Worker ready?
- ServiceWorker Cookbook
- The offline cookbook(offline 詳解)
- GoogleChrome/sw-toolbox
- GoogleChrome/sw-precache
- goldhand/sw-precache-webpack-plugin
- sw-precache? sw-toolbox? What's the difference?
A: self 會指向 ServiceWorkerGlobalScope,一定要使用 self,才能找到對應的屬性以及註冊、快取等事件。
資料來源: Should I use self or this in service worker? http://stackoverflow.com/questions/38040044/should-i-use-self-or-this-in-service-worker
A: 可以參考這篇:What is the storage limit for a service worker? http://stackoverflow.com/questions/35242869/what-is-the-storage-limit-for-a-service-worker
另外『Offline Storage for Progressive Web Apps』文章裡面有提到
Let’s get right to the point with a general recommendation for storing data offline: For URL addressable resources, use the Cache API (part of service workers). For all other data, use IndexedDB (with a Promises wrapper).
理由是 Cache API 和 IndexedDB 都是非同步 (IndexedDB is event based and the Cache API is Promise based),均可以在 web workers、window、service workers 這三種環境裡運作。
Pokedex Progressive Web App 的案例,就是使用 Cache API 和 IndexedDB 作為 Offline Storage。 https://www.pokedex.org/
資料來源: Offline Storage for Progressive Web Apps https://developers.google.com/web/fundamentals/instant-and-offline/web-storage/offline-for-pwa?hl=zh-tw
Web Storage Overview - Comparison https://developers.google.com/web/fundamentals/instant-and-offline/web-storage/?hl=zh-tw#comparison
A: Yes,可以使用 sw-precache,或者搭配 webpack 使用 sw-precache-webpack-plugin。
資料來源: sw-precache https://github.com/GoogleChrome/sw-precache
sw-precache-webpack-plugin https://github.com/AnnaSu/todolist-pwa-demo/tree/sw-precache-webpack-plugin
A: 有的,官方有釋出 Lighthouse,可以針對 PWA 做評分。
資料來源: GoogleChrome/lighthouse(open-source) https://github.com/GoogleChrome/lighthouse
lighthouse 介紹 https://developers.google.com/web/tools/lighthouse/
A: 可以修改 cacheId 的值來變更 cache 名稱,或者修改檔案命名,進一步取得新的 cache。
可以參考 Google Developer Training: https://google-developer-training.gitbooks.io/progressive-web-apps-ilt-codelabs/content/docs/lab_sw-precache_and_sw-toolbox.html#4
DEMO: https://github.com/GoogleChrome/sw-precache/blob/master/demo/gulpfile.js
A: 可以,基本做法就是把 request 暫存到 IndexDB,等到上線後再發出。
不過我也還沒有實作過,但可以參考:
https://bitsofco.de/bitsofcode-pwa-part-2-instant-loading-with-indexeddb/
https://developers.google.com/web/fundamentals/instant-and-offline/web-storage/offline-for-pwa
https://developers.google.com/web/fundamentals/getting-started/codelabs/push-notifications/
https://github.com/GoogleChrome/samples/tree/gh-pages/push-messaging-and-notifications
- PWA 與 Service Worker (2017/01/23【F2E&RGBA Meetup】所分享的簡報)
- PWA 應用 - 實現網站離線瀏覽 (2017/04/13【線上 React 讀書會】所分享的簡報)
-
simple-pwa-demo
-
PWA To-Do List with Vanilla JS
-
PWA To-Do List with Vanilla JS (sw-precache)
-
PWA To-Do List with Vanilla JS (sw-precache-webpack-plugin)
-
PWA To-Do List with React/Redux