MCPcopy
hub / github.com/rrweb-io/rrweb / on

Function on

packages/rrweb/src/utils.ts:19–27  ·  view source on GitHub ↗
(
  type: string,
  fn: EventListenerOrEventListenerObject,
  target: Document | IWindow = document,
)

Source from the content-addressed store, hash-verified

17export { nowTimestamp } from '@rrweb/utils';
18
19export function on(
20 type: string,
21 fn: EventListenerOrEventListenerObject,
22 target: Document | IWindow = document,
23): listenerHandler {
24 const options = { capture: true, passive: true };
25 target.addEventListener(type, fn, options);
26 return () => target.removeEventListener(type, fn, options);
27}
28
29// https://github.com/rrweb-io/rrweb/pull/407
30const DEPARTED_MIRROR_ACCESS_WARNING =

Callers 8

recordFunction · 0.90
initMoveObserverFunction · 0.90
initScrollObserverFunction · 0.90
initInputObserverFunction · 0.90
initSelectionObserverFunction · 0.90

Calls 1

addEventListenerMethod · 0.80

Tested by

no test coverage detected