@empathyco/x-components
Version:
Empathy X Components
26 lines (17 loc) • 1.51 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) > [(constructor)](./x-components.xprioritybus._constructor_.md)
## XPriorityBus.(constructor)
Creates a new instance of a [XPriorityBus](./x-components.xprioritybus.md)<!-- -->.
**Signature:**
```typescript
constructor(config?: {
queue?: XPriorityQueue<SomeEvents, XPriorityQueueNodeData<SomeEvents, SomeEventMetadata>>;
priorities?: Dictionary<number>;
emitCallbacks?: AnyFunction[];
defaultEventPriority?: number;
});
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| config | { queue?: [XPriorityQueue](./x-components.xpriorityqueue.md)<!-- --><SomeEvents, [XPriorityQueueNodeData](./x-components.xpriorityqueuenodedata.md)<!-- --><SomeEvents, SomeEventMetadata>>; priorities?: Dictionary<number>; emitCallbacks?: AnyFunction\[\]; defaultEventPriority?: number; } | _(Optional)_ A configuration object to initialise the bus. - param config.queue - A [priority queue](./x-components.xpriorityqueue.md) to store the events. - param config.priorities - A Dictionary defining the priorities associated to a given string. - param config.emitCallbacks - A list of functions to execute when an event is emitted. - param config.defaultEventPriority - A default priority to assigned to an event. |