Problem/Motivation
Only one service worker can be registered as top level scoped service worker and there are plenty of reasons why a service worker may want to be the top level service worker. Currently the service worker does everything and is pretty rigid in how it does so.
Steps to reproduce
Proposed resolution
The service worker should be adjusted so that we can create some sort of plugins. These plugins are currently proposed for the "push" handler and the "notification click" handler.
The push handler type is specified by the server sending the push notification. The notification click handler is specified by the push handler.
By using a lookup table in the service worker and routing the events according to the selected type we can easily extend the service worker by concatenating extra scripts into the service worker that register new push or notification click handlers.
Comments
Comment #2
kingdutchWith the latest updates to the module the Service Worker script is nicely loaded through the
ServiceWorkerControllerfor thesocial_pwa.service-workerroute. This means that if other modules want to replace the included service worker they can already overwrite the controller for that route. No special code for this are needed.Comment #3
kingdutchComment #5
kingdutch