Skip to content

Commit

Permalink
resume with time offset when after wait stylesheet load
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuyz0112 committed Apr 9, 2019
1 parent dcc7b92 commit faed623
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rrweb",
"version": "0.7.10",
"version": "0.7.11",
"description": "record and replay the web",
"scripts": {
"test": "npm run bundle:browser && cross-env TS_NODE_CACHE=false TS_NODE_FILES=true mocha -r ts-node/register test/**/*.test.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/record/observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function initMutationObserver(
: mirror.getId(n.previousSibling as INode),
nextId: !n.nextSibling
? n.nextSibling
: mirror.getId(n.nextSibling as INode),
: mirror.getId((n.nextSibling as unknown) as INode),
node: serializeNodeWithId(n, document, mirror.map, blockClass, true)!,
});
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/replay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export class Replayer {
this.pause();
this.emitter.emit(ReplayerEvents.LoadStylesheetStart);
timer = window.setTimeout(() => {
this.resume();
this.resume(this.timer.timeOffset);
// mark timer was called
timer = -1;
}, this.config.loadTimeout);
Expand All @@ -311,7 +311,7 @@ export class Replayer {
css.addEventListener('load', () => {
unloadSheets.delete(css);
if (unloadSheets.size === 0 && timer !== -1) {
this.resume();
this.resume(this.timer.timeOffset);
this.emitter.emit(ReplayerEvents.LoadStylesheetEnd);
if (timer) {
window.clearTimeout(timer);
Expand Down
3 changes: 2 additions & 1 deletion typings/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ export declare enum ReplayerEvents {
LoadStylesheetStart = "load-stylesheet-start",
LoadStylesheetEnd = "load-stylesheet-end",
SkipStart = "skip-start",
SkipEnd = "skip-end"
SkipEnd = "skip-end",
MouseInteraction = "mouse-interaction"
}
export {};

0 comments on commit faed623

Please sign in to comment.