ekzyis ade35b9ea0
Add verbose logging in onPush listener (#724)
* refactor: Use log function in service worker

* Add verbose logging on push listener

* Fix TypeError: Cannot read properties of null (reading 'postMessage')

navigator.serviceWorker.controller is null on forced refreshes:

"""
This property returns null if the request is a force refresh (Shift + refresh) or if there is no active worker.
"""

-- https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller

This means when we unregister a service worker manually (like I do for debugging purposes) and then reload the page, there is no service worker available when this code is run.

Adding a check with a more helpful error message should improve UX.

This error might also happen in other cases where a page refresh should also help.

---------

Co-authored-by: ekzyis <ek@stacker.news>
2024-01-03 11:51:04 -06:00
..
2023-12-04 21:34:06 -06:00
2023-07-24 13:53:53 -05:00
2023-11-06 14:53:33 -06:00
2023-12-30 17:16:09 -06:00
2023-08-25 18:21:51 -05:00
2023-12-04 21:34:06 -06:00
2023-12-21 17:45:03 -06:00
2023-12-31 10:52:19 -06:00
2023-12-27 18:14:22 -06:00
2023-10-26 14:36:20 -05:00
2023-12-04 21:34:06 -06:00
2023-08-04 20:45:12 -05:00
2023-12-10 16:56:22 -06:00
2023-11-10 09:22:14 -06:00
2023-08-29 19:13:21 -05:00
2024-01-02 16:35:01 -06:00
2023-08-04 19:21:51 -05:00
2023-11-09 19:05:35 -06:00
2023-12-25 18:05:45 -06:00
2023-07-24 13:53:53 -05:00
2022-08-18 13:15:24 -05:00
2023-11-13 20:02:34 -06:00
2021-05-06 16:15:22 -05:00
2023-12-27 10:15:18 -06:00
2023-12-30 17:16:09 -06:00
2023-12-31 10:52:19 -06:00
2023-12-30 17:16:09 -06:00
2023-12-26 20:27:52 -06:00
2023-12-26 20:27:52 -06:00
2022-01-27 13:18:48 -06:00
2023-10-26 13:01:01 -05:00
2023-08-17 13:40:21 -05:00
2023-11-01 11:57:55 -05:00
2023-08-17 13:40:21 -05:00
2023-08-17 13:40:21 -05:00
2021-10-15 13:05:34 -05:00
2023-10-01 18:03:52 -05:00
2023-07-24 13:53:53 -05:00
2023-09-28 15:02:25 -05:00
2023-12-04 21:34:06 -06:00
2023-07-24 13:53:53 -05:00
2023-07-24 13:53:53 -05:00
2023-10-03 14:35:53 -05:00
2023-12-04 21:34:06 -06:00
2023-10-06 15:01:51 -05:00
2023-08-11 17:05:21 -05:00
2023-12-04 21:34:06 -06:00
2023-07-24 19:50:55 -05:00
2023-05-06 16:51:17 -05:00
2023-11-09 19:05:35 -06:00
2023-12-30 17:16:09 -06:00
2023-08-25 18:43:50 -05:00
2023-12-24 16:49:41 -06:00
2023-12-30 18:43:41 -06:00
2023-08-25 18:21:51 -05:00
2023-12-31 10:52:19 -06:00
2023-12-20 18:54:56 -06:00
2023-12-26 20:27:52 -06:00
2023-08-04 19:21:51 -05:00
2023-07-24 13:53:53 -05:00