Skip to content

Commit 78abbc4

Browse files
authored
Merge pull request #683 from streamich/seq-patches
Allow reading patches sequentially
2 parents 6d52131 + ad98179 commit 78abbc4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/json-crdt-patch/codec/binary/Decoder.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ export class Decoder extends CborDecoder<CrdtReader> {
2929
* @returns A JSON CRDT patch.
3030
*/
3131
public decode(data: Uint8Array): Patch {
32+
this.reader.reset(data);
33+
return this.readPatch();
34+
}
35+
36+
public readPatch(): Patch {
3237
const reader = this.reader;
33-
reader.reset(data);
3438
const sid = reader.vu57();
3539
const time = reader.vu57();
3640
const isServerClock = sid === SESSION.SERVER;

0 commit comments

Comments
 (0)