@empathyco/x-components
Version:
Empathy X Components
31 lines (18 loc) • 1.06 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [BaseXPriorityQueue](./x-components.basexpriorityqueue.md) > [push](./x-components.basexpriorityqueue.push.md)
## BaseXPriorityQueue.push() method
. See [XPriorityQueue.push](./x-components.xpriorityqueue.push.md)<!-- -->.
**Signature:**
```typescript
push(key: keyof SomeRecord, priority: number, data?: SomeData): void;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| key | keyof SomeRecord | The key to insert. |
| priority | number | The priority to order the element in the queue. |
| data | SomeData | _(Optional)_ The extra data associated to a key and priority pair. |
**Returns:**
void
## Remarks
If the optional data has a 'replaceable: true' and a similar key is already in the queue, the previous key will be removed and the new one will be inserted to the queue at the correct position based on its new priority.