Skip to content

Commit e761f73

Browse files
committed
fixup! Various typescript fixes
1 parent f4289cd commit e761f73

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

packages/rrweb/src/record/observer.ts

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,6 @@ function initMouseInteractionObserver({
465465
let hrefAttr: string | null = null;
466466
let src: string | null = null;
467467
let targetText: string | null = null;
468-
let cEmissionEvent = emissionEvent as clickParam;
469468

470469
let sig_target =
471470
htarget.closest &&
@@ -506,24 +505,24 @@ function initMouseInteractionObserver({
506505
const image_target = sig_target as HTMLImageElement;
507506
src = image_target.src;
508507
}
509-
cEmissionEvent = {
510-
...cEmissionEvent,
508+
emissionEvent = {
509+
...emissionEvent,
511510
...(href && { href }),
512511
...(hrefAttr && { hrefAttr }),
513512
...(src && { src }),
514513
...(targetText && { targetText }),
515514
targetTagName: htarget.tagName,
516515
};
517516
if (htarget.classList && htarget.classList.length) {
518-
cEmissionEvent = {
519-
...cEmissionEvent,
517+
emissionEvent = {
518+
...emissionEvent,
520519
targetClasses: Array.from(htarget.classList),
521520
};
522521
}
523522

524523
if (htarget !== sig_target) {
525-
cEmissionEvent = {
526-
...cEmissionEvent,
524+
emissionEvent = {
525+
...emissionEvent,
527526
sigTargetTagName: sig_target.tagName,
528527
};
529528
}
@@ -540,8 +539,8 @@ function initMouseInteractionObserver({
540539
if (htargetBound === null) {
541540
htargetBound = (htarget as Element).getBoundingClientRect();
542541
}
543-
cEmissionEvent = {
544-
...cEmissionEvent,
542+
emissionEvent = {
543+
...emissionEvent,
545544
targetSelector: targetSelector,
546545
targetW: Math.round(10 * htargetBound.width) / 10,
547546
targetH: Math.round(10 * htargetBound.height) / 10,
@@ -571,8 +570,8 @@ function initMouseInteractionObserver({
571570

572571
// TODO: also reject tagNames and ids?
573572
if (targetSelector !== altTargetSelector) {
574-
cEmissionEvent = {
575-
...cEmissionEvent,
573+
emissionEvent = {
574+
...emissionEvent,
576575
altTargetSelector: altTargetSelector,
577576
};
578577
}
@@ -604,8 +603,8 @@ function initMouseInteractionObserver({
604603
targetSelector !== byIdTargetSelector &&
605604
byIdTargetSelector !== altTargetSelector
606605
) {
607-
cEmissionEvent = {
608-
...cEmissionEvent,
606+
emissionEvent = {
607+
...emissionEvent,
609608
byIdTargetSelector: byIdTargetSelector,
610609
};
611610
}
@@ -624,8 +623,8 @@ function initMouseInteractionObserver({
624623
targetSelector !== structuralTargetSelector &&
625624
structuralTargetSelector !== altTargetSelector
626625
) {
627-
cEmissionEvent = {
628-
...cEmissionEvent,
626+
emissionEvent = {
627+
...emissionEvent,
629628
structuralTargetSelector: structuralTargetSelector,
630629
};
631630
}
@@ -638,8 +637,8 @@ function initMouseInteractionObserver({
638637
className: (cn) => !cn.match(/[0-9]/),
639638
});
640639
if (targetSelector !== noNumericTargetSelector) {
641-
cEmissionEvent = {
642-
...cEmissionEvent,
640+
emissionEvent = {
641+
...emissionEvent,
643642
noNumericTargetSelector: noNumericTargetSelector,
644643
};
645644
}
@@ -664,7 +663,7 @@ function initMouseInteractionObserver({
664663
others_with_alt.length === 1 &&
665664
others_with_alt[0] === htarget
666665
) {
667-
cEmissionEvent[attr_name] = altAttributeSelector;
666+
(emissionEvent as clickParam)[attr_name] = altAttributeSelector;
668667
}
669668
}
670669
});

0 commit comments

Comments
 (0)