Frontmatter
| id | 3551 |
| title | main.addon.ServiceWorker: registerNeoConfig |
| state | Closed |
| labels | enhancement |
| assignees | tobiu |
| createdAt | Nov 6, 2022, 9:03 PM |
| updatedAt | Nov 6, 2022, 9:15 PM |
| githubUrl | https://github.com/neomjs/neo/issues/3551 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Nov 6, 2022, 9:05 PM |
main.addon.ServiceWorker: registerNeoConfig
tobiu assigned to @tobiu on Nov 6, 2022, 9:03 PM

tobiu
Nov 6, 2022, 9:05 PM
i did not find a cleaner approach and this workaround needs testing (works fine for me locally at least).
please add comments in case there are further problems and we can reopen the ticket.
I did try globalThis.clients.claim() without success inside worker.ServiceBase: onActivate().
tobiu closed this issue on Nov 6, 2022, 9:05 PM
navigator.serviceWorker.controller can be null in case we load a page for the first time or in case of a force refresh.
See: https://www.w3.org/TR/service-workers/#navigator-service-worker-controller
Only in this case
main.addon.ServiceWorkerwill store the active registration once ready insideworker.Managerto ensure the access and prevent JS errors.@Dinkh