encodeStateAsUpdate returns Uint8Array<ArrayBuffer>

This commit is contained in:
Kevin Jahns
2025-11-17 17:30:26 +01:00
parent b1b9552855
commit 27ab396fd8
2 changed files with 6 additions and 6 deletions

View File

@@ -494,7 +494,7 @@ export const writeStateAsUpdate = (encoder, doc, targetStateVector = new Map())
* @param {Doc} doc * @param {Doc} doc
* @param {Uint8Array} [encodedTargetStateVector] The state of the target that receives the update. Leave empty to write all known structs * @param {Uint8Array} [encodedTargetStateVector] The state of the target that receives the update. Leave empty to write all known structs
* @param {UpdateEncoderV1 | UpdateEncoderV2} [encoder] * @param {UpdateEncoderV1 | UpdateEncoderV2} [encoder]
* @return {Uint8Array} * @return {Uint8Array<ArrayBuffer>}
* *
* @function * @function
*/ */
@@ -530,7 +530,7 @@ export const encodeStateAsUpdateV2 = (doc, encodedTargetStateVector = new Uint8A
* *
* @param {Doc} doc * @param {Doc} doc
* @param {Uint8Array} [encodedTargetStateVector] The state of the target that receives the update. Leave empty to write all known structs * @param {Uint8Array} [encodedTargetStateVector] The state of the target that receives the update. Leave empty to write all known structs
* @return {Uint8Array} * @return {Uint8Array<ArrayBuffer>}
* *
* @function * @function
*/ */

View File

@@ -180,8 +180,8 @@ export class LazyStructWriter {
} }
/** /**
* @param {Array<Uint8Array>} updates * @param {Array<Uint8Array<ArrayBuffer>>} updates
* @return {Uint8Array} * @return {Uint8Array<ArrayBuffer>}
*/ */
export const mergeUpdates = updates => mergeUpdatesV2(updates, UpdateDecoderV1, UpdateEncoderV1) export const mergeUpdates = updates => mergeUpdatesV2(updates, UpdateDecoderV1, UpdateEncoderV1)
@@ -325,10 +325,10 @@ const sliceStruct = (left, diff) => {
* *
* This function works similarly to `readUpdateV2`. * This function works similarly to `readUpdateV2`.
* *
* @param {Array<Uint8Array>} updates * @param {Array<Uint8Array<ArrayBuffer>>} updates
* @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder] * @param {typeof UpdateDecoderV1 | typeof UpdateDecoderV2} [YDecoder]
* @param {typeof UpdateEncoderV1 | typeof UpdateEncoderV2} [YEncoder] * @param {typeof UpdateEncoderV1 | typeof UpdateEncoderV2} [YEncoder]
* @return {Uint8Array} * @return {Uint8Array<ArrayBuffer>}
*/ */
export const mergeUpdatesV2 = (updates, YDecoder = UpdateDecoderV2, YEncoder = UpdateEncoderV2) => { export const mergeUpdatesV2 = (updates, YDecoder = UpdateDecoderV2, YEncoder = UpdateEncoderV2) => {
if (updates.length === 1) { if (updates.length === 1) {