UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

12 lines (11 loc) 416 B
import { MsgPackEncoderFast as EncoderMessagePack } from '@jsonjoy.com/json-pack/lib/msgpack/MsgPackEncoderFast'; export class Encoder extends EncoderMessagePack { encode(patch) { this.writer.reset(); this.encodeArrayHeader(patch.length); const length = patch.length; for (let i = 0; i < length; i++) patch[i].encode(this); return this.writer.flush(); } }