From 21ba657653106dea5219494e9234d3c2ff5e4a5b Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Wed, 1 Apr 2026 12:00:00 +0800 Subject: [PATCH] resolve #28, init replayer config in the constructor --- src/replay/index.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/replay/index.ts b/src/replay/index.ts index 89199e37..c27a58c4 100644 --- a/src/replay/index.ts +++ b/src/replay/index.ts @@ -30,20 +30,13 @@ smoothscroll.polyfill(); // tslint:disable-next-line const mitt = (mittProxy as any).default || mittProxy; -const defaultConfig: playerConfig = { - speed: 1, - root: document.body, - loadTimeout: 0, - skipInactive: false, -}; - export class Replayer { public wrapper: HTMLDivElement; public timer: Timer; private events: eventWithTime[] = []; - private config: playerConfig = defaultConfig; + private config: playerConfig; private iframe: HTMLIFrameElement; private mouse: HTMLDivElement; @@ -66,8 +59,15 @@ export class Replayer { this.events = events; this.handleResize = this.handleResize.bind(this); + const defaultConfig: playerConfig = { + speed: 1, + root: document.body, + loadTimeout: 0, + skipInactive: false, + }; + this.config = Object.assign({}, defaultConfig, config); + this.timer = new Timer(this.config); - this.setConfig(Object.assign({}, config)); this.setupDom(); this.emitter.on('resize', this.handleResize as mitt.Handler); }