impl #81 custom event

This is the record side impl of custom event, according to the
issue, we may also add first-class support for the custom event
tag like display color labels in the replayer-ui.
This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 469dbd5dee
commit d92a946926
5 changed files with 139 additions and 5 deletions

View File

@@ -6,6 +6,7 @@ export enum EventType {
FullSnapshot,
IncrementalSnapshot,
Meta,
Custom,
}
export type domContentLoadedEvent = {
@@ -43,6 +44,14 @@ export type metaEvent = {
};
};
export type customEvent<T = unknown> = {
type: EventType.Custom;
data: {
tag: string;
payload: T;
};
};
export enum IncrementalSource {
Mutation,
MouseMove,
@@ -91,7 +100,8 @@ export type event =
| loadedEvent
| fullSnapshotEvent
| incrementalSnapshotEvent
| metaEvent;
| metaEvent
| customEvent;
export type eventWithTime = event & {
timestamp: number;