Created
September 30, 2020 03:42
-
-
Save oahehc/653a092dbb967f08d6910d64a64eb860 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// send message to service worker | |
function handleClickEven() { | |
worker.postMessage({ action: "skipWaiting" }); | |
} | |
// receive message | |
self.addEventListener("message", (event) => { | |
if (event.data.action === "skipWaiting") { | |
// skip waiting to apply the new version of service worker | |
self.skipWaiting(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment