![](/img/trans.png)
[英]Prefetch API data (dataGroups) using Angular Service Worker
[英]Prefetch API calls with service worker
我為我的 angular 應用程序設置了服務人員。 只要訪問了調用 API 的相關頁面,數據組的緩存就可以正常工作。 但是我的目標是在應用程序的負載上緩存 ngsw-config 中指定的所有端點的數據。 嘗試使用為 swUpdate 提供的示例,即:
swUpdate.available.subscribe(event => {
swUpdate.activateUpdate().then(() => document.location.reload());
});
在我的 appcomponent 的構造函數中啟動應用程序,但沒有運氣。 任何幫助表示贊賞。 TIA。
它需要從服務器下載元數據嘗試如下
swUpdate.available.subscribe(event => {
swUpdate.activateUpdate().then(() => document.location.reload());
});
if(swUpdate.isEnabled) {
swUpdate.checkForUpdate();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.