@empathyco/x-components
Version:
Empathy X Components
29 lines (17 loc) • 1.13 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [XPriorityBus](./x-components.xprioritybus.md) > [emit](./x-components.xprioritybus.emit.md)
## XPriorityBus.emit() method
Emits an event. See [XBus.emit](./x-components.xbus.emit.md)<!-- -->.
**Signature:**
```typescript
emit<SomeEvent extends keyof SomeEvents>(event: SomeEvent, payload?: EventPayload<SomeEvents, SomeEvent>, metadata?: SomeEventMetadata): Promise<EmittedData<SomeEvents, SomeEvent, SomeEventMetadata>>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| event | SomeEvent | Event to be emitted. |
| payload | [EventPayload](./x-components.eventpayload.md)<!-- --><SomeEvents, SomeEvent> | _(Optional)_ Event payload. |
| metadata | SomeEventMetadata | _(Optional)_ Extra event data. |
**Returns:**
Promise<[EmittedData](./x-components.emitteddata.md)<!-- --><SomeEvents, SomeEvent, SomeEventMetadata>>
A promise that is resolved the moment the event is emitted.