Skip to content

Commit

Permalink
use native setTimeout,add/removeEventListener when zone.js is present
Browse files Browse the repository at this point in the history
  • Loading branch information
mdellanoce authored and jeffdnguyen committed Jul 29, 2024
1 parent 81fa46f commit 25e412e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .changeset/fair-seahorses-care.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"rrweb": patch
'rrweb': patch
---

Use native setTimeout when zone.js is present
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb-snapshot/src/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
getInputType,
toLowerCase,
extractFileExtension,
nativeSetTimeout,
nativeSetTimeout
} from './utils';

let _id = 1;
Expand Down
3 changes: 2 additions & 1 deletion packages/rrweb-snapshot/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type {
MaskInputFn,
MaskInputOptions,
nodeMetaMap,
NodeType,
serializedNodeWithId,
serializedNode,
documentNode,
Expand All @@ -14,6 +13,8 @@ import type {
IWindow,
} from './types';

import { NodeType } from './types';

export function isElement(n: Node): n is Element {
return n.nodeType === n.ELEMENT_NODE;
}
Expand Down
4 changes: 1 addition & 3 deletions packages/rrweb/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ import type {
textMutation,
} from '@rrweb/types';
import type { IMirror, Mirror, SlimDOMOptions } from 'rrweb-snapshot';
import { isShadowRoot, IGNORED_NODE, classMatchesRegex } from 'rrweb-snapshot';
import {
isShadowRoot,
IGNORED_NODE,
classMatchesRegex,
getNative,
nativeSetTimeout
} from 'rrweb-snapshot';
Expand Down
2 changes: 2 additions & 0 deletions packages/types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -708,3 +708,5 @@ export { IWindow };
// Types for @rrweb/packer
export type PackFn = (event: eventWithTime) => string;
export type UnpackFn = (raw: string) => eventWithTime;

export { IWindow };

0 comments on commit 25e412e

Please sign in to comment.