Core
Framework v2.x
2

once() #

Available since 2.9.0
Experimental: non-backward compatible changes or removal may occur in any future release.

Listens to an event emitted with BackendCluster.broadcast.

The registered listener will be called exactly once, after which it will be removed from the listeners list.

Copied to clipboard!
once (event: string, listener: EventHandler): Promise<void>

Argument Type Description
event
string
Event name
listener
EventHandler
Listener function. Called exactly once.

Usage #

Copied to clipboard!
app.cluster.once('some:event', payload => {
  // ...listener code...
})