Skip to content

Commit 342126f

Browse files
committed
feat: Remove hooks related code, which is not used
1 parent d7eaeb9 commit 342126f

File tree

2 files changed

+141
-259
lines changed

2 files changed

+141
-259
lines changed

packages/rrweb/src/record/index.ts

Lines changed: 139 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ function record<T = eventWithTime>(
9696
maskAttributeFn,
9797
maskInputFn,
9898
maskTextFn,
99-
hooks,
10099
packFn,
101100
sampling = {},
102101
dataURLOptions = {},
@@ -462,149 +461,146 @@ function record<T = eventWithTime>(
462461
const handlers: listenerHandler[] = [];
463462

464463
const observe = (doc: Document) => {
465-
return callbackWrapper(initObservers)(
466-
{
467-
onMutation,
468-
mutationCb: wrappedMutationEmit,
469-
mousemoveCb: (positions, source) =>
470-
wrappedEmit(
471-
wrapEvent({
472-
type: EventType.IncrementalSnapshot,
473-
data: {
474-
source,
475-
positions,
476-
},
477-
}),
478-
),
479-
mouseInteractionCb: (d) =>
480-
wrappedEmit(
481-
wrapEvent({
482-
type: EventType.IncrementalSnapshot,
483-
data: {
484-
source: IncrementalSource.MouseInteraction,
485-
...d,
486-
},
487-
}),
488-
),
489-
scrollCb: wrappedScrollEmit,
490-
viewportResizeCb: (d) =>
491-
wrappedEmit(
492-
wrapEvent({
493-
type: EventType.IncrementalSnapshot,
494-
data: {
495-
source: IncrementalSource.ViewportResize,
496-
...d,
497-
},
498-
}),
499-
),
500-
inputCb: (v) =>
501-
wrappedEmit(
502-
wrapEvent({
503-
type: EventType.IncrementalSnapshot,
504-
data: {
505-
source: IncrementalSource.Input,
506-
...v,
507-
},
508-
}),
509-
),
510-
mediaInteractionCb: (p) =>
511-
wrappedEmit(
512-
wrapEvent({
513-
type: EventType.IncrementalSnapshot,
514-
data: {
515-
source: IncrementalSource.MediaInteraction,
516-
...p,
517-
},
518-
}),
519-
),
520-
styleSheetRuleCb: (r) =>
521-
wrappedEmit(
522-
wrapEvent({
523-
type: EventType.IncrementalSnapshot,
524-
data: {
525-
source: IncrementalSource.StyleSheetRule,
526-
...r,
527-
},
528-
}),
529-
),
530-
styleDeclarationCb: (r) =>
531-
wrappedEmit(
532-
wrapEvent({
533-
type: EventType.IncrementalSnapshot,
534-
data: {
535-
source: IncrementalSource.StyleDeclaration,
536-
...r,
537-
},
538-
}),
539-
),
540-
canvasMutationCb: wrappedCanvasMutationEmit,
541-
fontCb: (p) =>
542-
wrappedEmit(
543-
wrapEvent({
544-
type: EventType.IncrementalSnapshot,
545-
data: {
546-
source: IncrementalSource.Font,
547-
...p,
548-
},
549-
}),
550-
),
551-
selectionCb: (p) => {
552-
wrappedEmit(
553-
wrapEvent({
554-
type: EventType.IncrementalSnapshot,
555-
data: {
556-
source: IncrementalSource.Selection,
557-
...p,
558-
},
559-
}),
560-
);
561-
},
562-
customElementCb: (c) => {
563-
wrappedEmit(
564-
wrapEvent({
565-
type: EventType.IncrementalSnapshot,
566-
data: {
567-
source: IncrementalSource.CustomElement,
568-
...c,
569-
},
570-
}),
571-
);
572-
},
573-
blockClass,
574-
ignoreClass,
575-
ignoreSelector,
576-
maskAllText,
577-
maskTextClass,
578-
unmaskTextClass,
579-
maskTextSelector,
580-
unmaskTextSelector,
581-
maskInputOptions,
582-
inlineStylesheet,
583-
sampling,
584-
recordCanvas,
585-
inlineImages,
586-
userTriggeredOnInput,
587-
collectFonts,
588-
doc,
589-
maskAttributeFn,
590-
maskInputFn,
591-
maskTextFn,
592-
keepIframeSrcFn,
593-
blockSelector,
594-
unblockSelector,
595-
slimDOMOptions,
596-
dataURLOptions,
597-
mirror,
598-
iframeManager,
599-
stylesheetManager,
600-
shadowDomManager,
601-
processedNodeManager,
602-
canvasManager,
603-
ignoreCSSAttributes,
604-
plugins: [],
464+
return callbackWrapper(initObservers)({
465+
onMutation,
466+
mutationCb: wrappedMutationEmit,
467+
mousemoveCb: (positions, source) =>
468+
wrappedEmit(
469+
wrapEvent({
470+
type: EventType.IncrementalSnapshot,
471+
data: {
472+
source,
473+
positions,
474+
},
475+
}),
476+
),
477+
mouseInteractionCb: (d) =>
478+
wrappedEmit(
479+
wrapEvent({
480+
type: EventType.IncrementalSnapshot,
481+
data: {
482+
source: IncrementalSource.MouseInteraction,
483+
...d,
484+
},
485+
}),
486+
),
487+
scrollCb: wrappedScrollEmit,
488+
viewportResizeCb: (d) =>
489+
wrappedEmit(
490+
wrapEvent({
491+
type: EventType.IncrementalSnapshot,
492+
data: {
493+
source: IncrementalSource.ViewportResize,
494+
...d,
495+
},
496+
}),
497+
),
498+
inputCb: (v) =>
499+
wrappedEmit(
500+
wrapEvent({
501+
type: EventType.IncrementalSnapshot,
502+
data: {
503+
source: IncrementalSource.Input,
504+
...v,
505+
},
506+
}),
507+
),
508+
mediaInteractionCb: (p) =>
509+
wrappedEmit(
510+
wrapEvent({
511+
type: EventType.IncrementalSnapshot,
512+
data: {
513+
source: IncrementalSource.MediaInteraction,
514+
...p,
515+
},
516+
}),
517+
),
518+
styleSheetRuleCb: (r) =>
519+
wrappedEmit(
520+
wrapEvent({
521+
type: EventType.IncrementalSnapshot,
522+
data: {
523+
source: IncrementalSource.StyleSheetRule,
524+
...r,
525+
},
526+
}),
527+
),
528+
styleDeclarationCb: (r) =>
529+
wrappedEmit(
530+
wrapEvent({
531+
type: EventType.IncrementalSnapshot,
532+
data: {
533+
source: IncrementalSource.StyleDeclaration,
534+
...r,
535+
},
536+
}),
537+
),
538+
canvasMutationCb: wrappedCanvasMutationEmit,
539+
fontCb: (p) =>
540+
wrappedEmit(
541+
wrapEvent({
542+
type: EventType.IncrementalSnapshot,
543+
data: {
544+
source: IncrementalSource.Font,
545+
...p,
546+
},
547+
}),
548+
),
549+
selectionCb: (p) => {
550+
wrappedEmit(
551+
wrapEvent({
552+
type: EventType.IncrementalSnapshot,
553+
data: {
554+
source: IncrementalSource.Selection,
555+
...p,
556+
},
557+
}),
558+
);
605559
},
606-
hooks,
607-
);
560+
customElementCb: (c) => {
561+
wrappedEmit(
562+
wrapEvent({
563+
type: EventType.IncrementalSnapshot,
564+
data: {
565+
source: IncrementalSource.CustomElement,
566+
...c,
567+
},
568+
}),
569+
);
570+
},
571+
blockClass,
572+
ignoreClass,
573+
ignoreSelector,
574+
maskAllText,
575+
maskTextClass,
576+
unmaskTextClass,
577+
maskTextSelector,
578+
unmaskTextSelector,
579+
maskInputOptions,
580+
inlineStylesheet,
581+
sampling,
582+
recordCanvas,
583+
inlineImages,
584+
userTriggeredOnInput,
585+
collectFonts,
586+
doc,
587+
maskAttributeFn,
588+
maskInputFn,
589+
maskTextFn,
590+
keepIframeSrcFn,
591+
blockSelector,
592+
unblockSelector,
593+
slimDOMOptions,
594+
dataURLOptions,
595+
mirror,
596+
iframeManager,
597+
stylesheetManager,
598+
shadowDomManager,
599+
processedNodeManager,
600+
canvasManager,
601+
ignoreCSSAttributes,
602+
plugins: [],
603+
});
608604
};
609605

610606
iframeManager.addLoadListener((iframeEl) => {

0 commit comments

Comments
 (0)