@empathyco/x-components
Version:
Empathy X Components
28 lines (16 loc) • 1.3 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) > [on](./x-components.xprioritybus.on.md)
## XPriorityBus.on() method
Retrieves an observable for the event. See [XBus.on](./x-components.xbus.on.md)<!-- -->.
**Signature:**
```typescript
on<SomeEvent extends keyof SomeEvents>(event: SomeEvent, withMetadata?: boolean): typeof withMetadata extends true ? Observable<SubjectPayload<EventPayload<SomeEvents, SomeEvent>, SomeEventMetadata>> : Observable<EventPayload<SomeEvents, SomeEvent>>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| event | SomeEvent | Event to retrieve the observable for. |
| withMetadata | boolean | _(Optional)_ Option to retrieve an observable with extra data about the event. |
**Returns:**
typeof withMetadata extends true ? Observable<[SubjectPayload](./x-components.subjectpayload.md)<!-- --><[EventPayload](./x-components.eventpayload.md)<!-- --><SomeEvents, SomeEvent>, SomeEventMetadata>> : Observable<[EventPayload](./x-components.eventpayload.md)<!-- --><SomeEvents, SomeEvent>>
The emitter for the event passed.