Event listener function in service workers seems to be implemented from EventTarget.addEventListener()
self.addEventListener('fetch', event => {
.....
});
This is the classic 'fetch type' in a service worker
I am wondering if I can use any of those "types" inside a service worker.
From this: https://developer.mozilla.org/en-US/docs/Web/Events , I can see several types of event listeners, such as 'click' or 'online' etc...
Is there any limitation of 'types' that service worker accepts? If yes, how can I recognize those from the documentation?
I know that for most of them, service workers won't have any sense, but I would love to understand how this works internally.
Please note that by type I mean the first parameter of the event listener in a service worker such as 'install', 'fetch', 'active' etc...
You may see the full list of supported events in the spec: https://www.w3.org/TR/service-workers/#execution-context-events
They mostly deal with network and different sorts of messsages. As I see it, the only ones dealing with direct user interaction are the notification click/close events.