LearnNewsExamplesServices
Frontmatter
id3551
titlemain.addon.ServiceWorker: registerNeoConfig
stateClosed
labels
enhancement
assigneestobiu
createdAtNov 6, 2022, 9:03 PM
updatedAtNov 6, 2022, 9:15 PM
githubUrlhttps://github.com/neomjs/neo/issues/3551
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtNov 6, 2022, 9:05 PM

main.addon.ServiceWorker: registerNeoConfig

Closed v8.1.0 enhancement
tobiu
tobiu commented on Nov 6, 2022, 9:03 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.ServiceWorker will store the active registration once ready inside worker.Manager to ensure the access and prevent JS errors.

@Dinkh

tobiu added the enhancement label on Nov 6, 2022, 9:03 PM
tobiu assigned to @tobiu on Nov 6, 2022, 9:03 PM
tobiu referenced in commit 6a1e22c - "main.addon.ServiceWorker: registerNeoConfig #3551" on Nov 6, 2022, 9:03 PM
tobiu
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