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
readonlysize:number
Defined in: queues/types.ts:185
Current number of events held in the queue.
Methods
enqueue()?
optionalenqueue(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
Consent category for the event.
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
flushEssential()
flushEssential():
QueuedEventUnion[]
Defined in: queues/types.ts:166
Flush only events that are considered essential.
Returns the flushed events.
Returns
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()?
optionalgetCapacity():number
Defined in: queues/types.ts:190
Maximum queue capacity, if the implementation exposes it.
Returns
number