Created
October 27, 2022 22:38
-
-
Save ehatricksmith/df8092b9ff197aaa8c524b6f7987bc77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as Y from "yjs"; | |
import * as util from "util"; | |
const ydoc = new Y.Doc(); | |
// Create a top level data type | |
const yarray = ydoc.getArray("listOfNumbers"); | |
yarray.insert(0, [2]); | |
yarray.delete(0); | |
// Log the underlying edits | |
const updates = Y.encodeStateAsUpdate(ydoc); | |
console.log( | |
util.inspect(Y.decodeUpdate(updates), { colors: true, depth: null }) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment