From 43b2290f5f83b8ed845ebba020c5c7c5b203bdb8 Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Thu, 18 Oct 2018 16:13:59 +0800 Subject: [PATCH] export reset id function --- index.d.ts | 1 + package.json | 2 +- src/index.ts | 4 ++-- src/snapshot.ts | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/index.d.ts b/index.d.ts index 85dc9653..bfd03d96 100644 --- a/index.d.ts +++ b/index.d.ts @@ -8,3 +8,4 @@ export function serializeNodeWithId( doc: Document, map: idNodeMap, ): serializedNodeWithId | null; +export function resetId(): void; diff --git a/package.json b/package.json index 6f32f4e4..6f56531c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rrweb-snapshot", - "version": "0.4.2", + "version": "0.4.3", "description": "rrweb's component to take a snapshot of DOM, aka DOM serializer", "main": "dist/index.js", "module": "dist/module.js", diff --git a/src/index.ts b/src/index.ts index fd969465..cba7b499 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ -import snapshot, { serializeNodeWithId } from './snapshot'; +import snapshot, { serializeNodeWithId, resetId } from './snapshot'; import rebuild from './rebuild'; export * from './types'; -export { snapshot, serializeNodeWithId, rebuild }; +export { snapshot, serializeNodeWithId, resetId, rebuild }; diff --git a/src/snapshot.ts b/src/snapshot.ts index fa3aea8c..c948fa14 100644 --- a/src/snapshot.ts +++ b/src/snapshot.ts @@ -13,7 +13,7 @@ function genId(): number { return _id++; } -function resetId() { +export function resetId() { _id = 1; }