Page Contents

Home > @loopback/context > Context > once

Context.once() method

The “bind” event is emitted when a new binding is added to the context. The “unbind” event is emitted when an existing binding is removed.

Signature:

once(eventName: 'bind' | 'unbind', listener: ContextEventListener): this;

Parameters

Parameter Type Description
eventName ‘bind’ | ‘unbind’ The name of the event - always bind or unbind.
listener ContextEventListener The listener function to call when the event is emitted.

Returns:

this