Defined in: packages/db/src/types.ts:201
Public interface for a collection subscription Used by sync implementations to track subscription lifecycle
readonly status: SubscriptionStatus;
readonly status: SubscriptionStatus;
Defined in: packages/db/src/types.ts:203
Current status of the subscription
protected clearListeners(): void;
protected clearListeners(): void;
Defined in: packages/db/src/event-emitter.ts:115
Clear all listeners
void
EventEmitter.clearListeners
EventEmitter.clearListeners
protected emitInner<T>(event, eventPayload): void;
protected emitInner<T>(event, eventPayload): void;
Defined in: packages/db/src/event-emitter.ts:96
Internal
Emit an event to all listeners
T extends keyof SubscriptionEvents
T
Event name to emit
Event payload For use by subclasses - subclasses should wrap this with a public emit if needed
void
EventEmitter.emitInner
EventEmitter.emitInner
off<T>(event, callback): void;
off<T>(event, callback): void;
Defined in: packages/db/src/event-emitter.ts:53
Unsubscribe from an event
T extends keyof SubscriptionEvents
T
Event name to stop listening for
(event) => void
Function to remove
void
EventEmitter.off
EventEmitter.off
on<T>(event, callback): () => void;
on<T>(event, callback): () => void;
Defined in: packages/db/src/event-emitter.ts:17
Subscribe to an event
T extends keyof SubscriptionEvents
T
Event name to listen for
(event) => void
Function to call when event is emitted
Unsubscribe function
(): void;
(): void;
void
EventEmitter.on
EventEmitter.on
once<T>(event, callback): () => void;
once<T>(event, callback): () => void;
Defined in: packages/db/src/event-emitter.ts:37
Subscribe to an event once (automatically unsubscribes after first emission)
T extends keyof SubscriptionEvents
T
Event name to listen for
(event) => void
Function to call when event is emitted
Unsubscribe function
(): void;
(): void;
void
EventEmitter.once
EventEmitter.once
waitFor<T>(event, timeout?): Promise<SubscriptionEvents[T]>;
waitFor<T>(event, timeout?): Promise<SubscriptionEvents[T]>;
Defined in: packages/db/src/event-emitter.ts:66
Wait for an event to be emitted
T extends keyof SubscriptionEvents
T
Event name to wait for
number
Optional timeout in milliseconds
Promise<SubscriptionEvents[T]>
Promise that resolves with the event payload
EventEmitter.waitFor
EventEmitter.waitFor