Skip to content

Commit

Permalink
Allow to be chained directly after the constructor so that event hand…
Browse files Browse the repository at this point in the history
…ling for the first full snapshot can be added straight after constructor. See rrweb-io#216
  • Loading branch information
eoghanmurray committed Nov 11, 2020
1 parent 03a0330 commit a866777
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/replay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,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>) {
Expand Down

0 comments on commit a866777

Please sign in to comment.