<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [XPriorityBus](./x-components.xprioritybus.md) &gt; [(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

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

config


</td><td>

{ queue?: [XPriorityQueue](./x-components.xpriorityqueue.md)<!-- -->&lt;SomeEvents, [XPriorityQueueNodeData](./x-components.xpriorityqueuenodedata.md)<!-- -->&lt;SomeEvents, SomeEventMetadata&gt;&gt;; priorities?: Dictionary&lt;number&gt;; emitCallbacks?: AnyFunction\[\]; defaultEventPriority?: number; }


</td><td>

_(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.


</td></tr>
</tbody></table>

