Skip to content

trackkit / queues/types / IQueue

Interface: IQueue ​

Defined in: queues/types.ts:134

Internal

Interface for the facade’s event queue implementation.

This is intentionally minimal; it allows for:

  • a no-op SSR implementation,
  • an in-memory runtime queue,
  • or more sophisticated queues if needed.

Properties ​

size ​

readonly size: number

Defined in: queues/types.ts:185

Current number of events held in the queue.

Methods ​

enqueue()? ​

optional enqueue(type, args, category, pageContext?): undefined | string

Defined in: queues/types.ts:147

Enqueue a new event.

This is intentionally optional so an SSR-only implementation can omit it on the server and only wire it up on the client.

Parameters ​

type ​

Event type ('track', 'pageview', 'identify').

"track" | "pageview" | "identify"

args ​

Argument tuple for the event type.

[string, Props, string] | [string] | [null | string]

category ​

ConsentCategory

Consent category for the event.

pageContext? ​

PageContext

Optional page context snapshot.

Returns ​

undefined | string

A unique event ID, or undefined if enqueue is not supported.


flush() ​

flush(): QueuedEventUnion[]

Defined in: queues/types.ts:159

Flush all events from the queue, regardless of category.

Returns the flushed events in FIFO order.

Returns ​

QueuedEventUnion[]


flushEssential() ​

flushEssential(): QueuedEventUnion[]

Defined in: queues/types.ts:166

Flush only events that are considered essential.

Returns the flushed events.

Returns ​

QueuedEventUnion[]


clear() ​

clear(): number

Defined in: queues/types.ts:173

Clear all events from the queue.

Returns ​

number

Number of events removed.


clearNonEssential() ​

clearNonEssential(): number

Defined in: queues/types.ts:180

Clear only non-essential events from the queue.

Returns ​

number

Number of events removed.


getCapacity()? ​

optional getCapacity(): number

Defined in: queues/types.ts:190

Maximum queue capacity, if the implementation exposes it.

Returns ​

number

Released under the MIT License.