Allow .on to be chained directly after the constructor so that event handling for the first full snapshot can be added straight after constructor. See #216 (#416)

This commit is contained in:
Eoghan Murray
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 9ef95fe06e
commit 4726500979

View File

@@ -194,14 +194,17 @@ export class Replayer {
}, 0);
}
if (firstFullsnapshot) {
this.rebuildFullSnapshot(
firstFullsnapshot as fullSnapshotEvent & { timestamp: number },
);
setTimeout(() => {
this.rebuildFullSnapshot(
firstFullsnapshot as fullSnapshotEvent & { timestamp: number },
);
}, 1);
}
}
public on(event: string, handler: Handler) {
this.emitter.on(event, handler);
return this;
}
public setConfig(config: Partial<playerConfig>) {