8000 expose missing parts that allow to decode binary messages by vane · Pull Request #712 · yjs/yjs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

expose missing parts that allow to decode binary messages #712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vane
Copy link
@vane vane commented May 16, 2025

There are not exposed parts that block decoding binary messages from other parts of application.
With those two exports it's possible with following code

import * as Y from "yjs"
import * as decoding from "lib0/decoding"
const doc = Y.Doc()
doc.on("update", (e) => {
	const structs = []
	const updateDecoder = new Y.UpdateDecoderV1(decoding.createDecoder(e))
	const lazyDecoder = new Y.LazyDecoder(updateDecoder)
	for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) {
		structs.push(curr)
	}
	const deleteSet = Y.readDeleteSet(updateDecoder)
	console.log(structs, deleteSet)
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0