From e6afc51b849e2d40b483107b2d74ac96095827ef Mon Sep 17 00:00:00 2001 From: Nik Graf Date: Sat, 7 Oct 2023 20:46:52 +0200 Subject: [PATCH] add documentation on V2 events --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 199e926e..a33cbc65 100644 --- a/README.md +++ b/README.md @@ -697,7 +697,8 @@ type. Doesn't log types that have not been defined (using on('update', function(updateMessage:Uint8Array, origin:any, Y.Doc):void)
Listen to document updates. Document updates must be transmitted to all other -peers. You can apply document updates in any order and multiple times. +peers. You can apply document updates in any order and multiple times. Use `updateV2` +to receive V2 events.
on('beforeTransaction', function(Y.Transaction, Y.Doc):void)
Emitted before each transaction.
@@ -822,8 +823,10 @@ Yjs implements two update formats. By default you are using the V1 update format You can opt-in into the V2 update format wich provides much better compression. It is not yet used by all providers. However, you can already use it if you are building your own provider. All below functions are available with the -suffix "V2". E.g. `Y.applyUpdate` ⇒ `Y.applyUpdateV2`. We also support conversion -functions between both formats: `Y.convertUpdateFormatV1ToV2` & `Y.convertUpdateFormatV2ToV1`. +suffix "V2". E.g. `Y.applyUpdate` ⇒ `Y.applyUpdateV2`. Also when listening to updates +you need to specifically need listen for V2 events e.g. `yDoc.on('updateV2', …)`. +We also support conversion functions between both formats: +`Y.convertUpdateFormatV1ToV2` & `Y.convertUpdateFormatV2ToV1`. #### Update API