Skip to content

Commit

Permalink
Allow .on to be chained directly after the constructor so that even…
Browse files Browse the repository at this point in the history
…t handling 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 db5b1fe commit 47fb02e
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 @@ -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>) {
Expand Down

0 comments on commit 47fb02e

Please sign in to comment.