Const Subscribe to an event that will automatically unsubscribe after the first occurrence
The event type to listen for
The callback to execute once
Unsubscribe function
Wait for multiple events to occur (Promise.all pattern)
Array of event types to wait for
Optional timeout: numberOptional timeout in milliseconds
Promise that resolves when all events have occurred
Wait for the first event to occur from a list (Promise.race pattern)
Array of event types to race
Optional timeout: numberOptional timeout in milliseconds
Promise that resolves with the first event
Filter events based on a predicate function
Unsubscribe function
Debounce events - only emit after a period of inactivity
The event type to debounce
Delay in milliseconds
Callback for debounced events
Unsubscribe function
Throttle events - limit emissions to once per interval
The event type to throttle
Minimum interval between emissions in milliseconds
Callback for throttled events
Unsubscribe function
Buffer events and emit them as an array
The event type to buffer
Time window to collect events in milliseconds
Callback for buffered events
Unsubscribe function
Create a replay subject that remembers the last N events
The event type to replay
Number of events to remember
Object with subscribe method that replays buffered events
Merge multiple event streams into one
Array of event types to merge
Callback for all merged events
Unsubscribe function for all subscriptions
Create a state machine that transitions based on events
Object with current state and unsubscribe function
Utility to create a promise that can be resolved by publishing an event
Event type to publish the request
Event type to wait for the response
The request data to publish
Optional timeout: numberOptional timeout in milliseconds
Promise that resolves with the response
Export a namespace with all utilities for easier access