Static
Readonly
telemetryStatic
Readonly
warningCreate a new listener for a given event
The name of the event that is being listened for
The callback function to run when the event is emitted
Optional
uniqueListenerIdentifier: stringA unique identifier for the listener. If a listener with the same identifier is already registered, a new one will not be added
Static
getStatic
static
An asynchronous event listener and emitter that follows the singleton pattern. The singleton pattern allows lifecycle events to be emitted from deep within a library and still be consumed by any other library or tool. It allows other developers to react to certain situations or events in your library without them having to manually call the method themselves.
An example might be transforming metadata before it is deployed to an environment. As long as an event was emitted from the deploy library and you were listening on that event in the same process, you could transform the metadata before the deploy regardless of where in the code that metadata was initiated.
Example