をチェックする必要があります
IOチームのおかげで、現在のサービスワーカーが冗長化されているかどうかを確認する必要があります。
// Check to see if the service worker controlling the page at initial load
// has become redundant, since this implies there's a new service worker with fresh content.
if (navigator.serviceWorker && navigator.serviceWorker.controller) {
navigator.serviceWorker.controller.onstatechange = function(event) {
if (event.target.state === 'redundant') {
// Define a handler that will be used for the next io-toast tap, at which point it
// be automatically removed.
const tapHandler = function() {
window.location.reload();
};
if (IOWA.Elements && IOWA.Elements.Toast &&
IOWA.Elements.Toast.showMessage) {
IOWA.Elements.Toast.showMessage(
'A new version of this app is available.', tapHandler, 'Refresh',
null, 0); // duration 0 indications shows the toast indefinitely.
} else {
tapHandler(); // Force reload if user never was shown the toast.
}
}
};
}
ここ
のWebアプリケーションのサポート[プッシュ通知](https://developers.google.com/あなたの質問に答えるだろうと考えているものですweb/fundamentals/getting-started/codelabs /プッシュ通知/)しかし、これは、アプリケーションが更新されたことをユーザーに通知するために使用するのは間違っているようです。そして、なぜあなたは "ブラウザを再起動"したいですか?サービスワーカーは変更を検出すると自動的にこれを行います... – alesc
サービスワーカーがアプリケーションを再起動しないということは、キャッシュのダウンロードが完了したら再起動する必要があるということですキャッシュの新しいアプリケーションを取得するアプリ...私はちょうどEric Bidelがこれについて話しているIOでの話を思い出しました、私はこの話を見つけることを試みます。 – eskan