Fix ServiceWorkerRegistration is not defined (#173)#182
Fix ServiceWorkerRegistration is not defined (#173)#182gpoole wants to merge 2 commits intomarkcellus:nextfrom
Conversation
|
Seems reasonable. Thanks! |
|
@gpoole before merging this, do you mind creating a test for it? Just want to avoid this being reverted. Test file is located in the test directory and should be pretty easy. Thanks again! |
|
@gpoole @markcellus I'd be willing to help adding a test to get this MR merged. I'm running into the same issue and am currently patching |
|
Yeah pls add tests and repro steps thanks. And will take another look. I was waiting to see if someone could give me steps to reproduce on my machine so I can verify locally before merging. 👍 |
|
Actually can't get the tests to run through at all.
I' on node |
|
Another way to check is using the console on http://example.com (make sure you're not redirected to HTTPS). I'm not really sure how to add a test for this as it requires deleting the global |

Adds an additional check for
ServiceWorkerRegistrationbeing defined before trying to access it, allowing the module to be imported in non-browser environments or browsers that don't defineServiceWorkerRegistration.Fixes #173