-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do thisYou can do thisPursuitFellowshipHelp wanted from Pursuit fellowship; others please avoid until Dec 19Help wanted from Pursuit fellowship; others please avoid until Dec 19
Milestone
Description
TypeScript Version: 3.9.7
Search Terms:
serviceworker listener
serviceworker statechange
serviceworker onstatechange
Code
const updateServiceWorker = () => {
const registrationWaiting = serviceWorkerRegistration?.waiting;
if (registrationWaiting) {
registrationWaiting.postMessage({ type: "SKIP_WAITING" });
registrationWaiting.addEventListener("statechange", (e) => {
if (e.target.state === "activated") {
window.location.reload(true);
}
});
}
};
Expected behaviour:
Above event.target is ServiceWorker
type
Actual behaviour:
Above event.target is EventTarget
type
will-stone
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do thisYou can do thisPursuitFellowshipHelp wanted from Pursuit fellowship; others please avoid until Dec 19Help wanted from Pursuit fellowship; others please avoid until Dec 19