EventLog
A bounded log of sent events, for replaying what a reconnecting client missed.
A bounded log of sent events, for replaying what a reconnecting client missed.
Import#
ts
import type { EventLog } from "@shadow-js/dusk/server";
Signature#
ts
interface EventLog {
/** Records an event; returns the id it was given (1, 2, 3, ...). */
append(message: { readonly event?: string; readonly data: unknown }): string;
/**
* The events after `lastEventId`, in order. `undefined` when the id is one the log no longer keeps
* (so events were lost and the client must resync) or is not an id the log has given.
*/
since(lastEventId: string | undefined): readonly LoggedEvent[] | undefined;
/** How many events the log holds (never more than its capacity). */
readonly size: number;
}
Members#
| Name | Type | Description |
|---|---|---|
append |
append(message: { readonly event?: string; readonly data: unknown }): string |
Records an event; returns the id it was given (1, 2, 3, ...). |
since |
since(lastEventId: string | undefined): readonly LoggedEvent[] | undefined |
The events after lastEventId, in order. undefined when the id is one the log no longer keeps (so events were lost and the client must resync) or is not an id the log has given. |
size |
readonly size: number |
How many events the log holds (never more than its capacity). |