Add ability to reset the mapping id, to facilitate destructor in rrweb (rrwebRecord.stop) (#49)

This commit is contained in:
Eoghan Murray
2020-10-24 09:10:51 +01:00
committed by GitHub
parent b3e7d5a476
commit 14bdd67459
4 changed files with 10 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ import snapshot, {
serializeNodeWithId,
transformAttribute,
visitSnapshot,
cleanupSnapshot,
IGNORED_NODE,
} from './snapshot';
import rebuild, { buildNodeWithSN, addHoverClass } from './rebuild';
@@ -15,5 +16,6 @@ export {
addHoverClass,
transformAttribute,
visitSnapshot,
cleanupSnapshot,
IGNORED_NODE,
};

View File

@@ -570,4 +570,9 @@ export function visitSnapshot(
walk(node);
}
export function cleanupSnapshot() {
// allow a new recording to start numbering nodes from scratch
_id = 1;
}
export default snapshot;