The push
event is only dispatched to a ServiceWorkerGlobalScope
. Events are registered by calling serviceWorkerRegistration.pushManager.subscribe(...)
.
The sync
event is only dispatched to a ServiceWorkerGlobalScope
. Events are registered by calling serviceWorkerRegistration.sync.register(...)
.
Persistent notifications dispatch events to a ServiceWorkerGlobalScope
, while non-persistent notifications dispatch them to a Notification
in a Window
's realm.
new Notification()
creates a non-persistent notification, while serviceWorkerRegistration.showNotification()
creates a persistent one.
So, different spellings for the different event targets, and no way to direct an event to a Worker or SharedWorker.
https://notifications.spec.whatwg.org/#create-a-notification
Most Worklets don't handle events registered from Windows.
paintWorklet
is called when CSS uses thepaint(name)
function.renderWorklet
is called when CSS uses the*layout(name)
functions.
The AudioWorklet proposal includes a AudioWorkletNode(..., "name", ...).postMessage()
function that causes a call to the onmessage()
member of an AudioWorkletProcessor
subclass registered for "name"
, running in an AudioWorkletGlobalScope
. This matches the pattern of calling a method on a main-window representation of a worker to cause an event to happen on an instance of that worker.