From 7cad96ee3ccdd7bb3b13881fe99298ba08a2e7e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Sat, 4 May 2019 12:31:10 +0200 Subject: [PATCH] add some comments --- examples/Components/Routes/Collaboration/index.vue | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/Components/Routes/Collaboration/index.vue b/examples/Components/Routes/Collaboration/index.vue index 5756da26..9189911b 100644 --- a/examples/Components/Routes/Collaboration/index.vue +++ b/examples/Components/Routes/Collaboration/index.vue @@ -38,8 +38,12 @@ export default { extensions: [ new History(), new Collaboration({ + // the initial version we start with + // version is an integer which is incremented with every change version, + // debounce changes so we can save some bandwidth debounce: 250, + // onSendable is called whenever there are changed we have to send to our server onSendable: data => { this.socket.emit('update', data) }, @@ -50,8 +54,11 @@ export default { }, mounted() { + // server implementation: https://glitch.com/edit/#!/tiptap-sockets this.socket = io('wss://tiptap-sockets.glitch.me') + // get the current document and its version .on('init', data => this.onInit(data)) + // send all updates to the collaboration extension .on('update', data => this.editor.extensions.options.collaboration.update(data)) },