IndexedDB database adapter for Yjs
Use the IndexedDB database adapter to store your shared data persistently in the browser. The next time you join the session, your changes will still be there.
- Minimizes the amount of data exchanged between server and client
- Makes offline editing possible
- Not supported by all browsers (see mdn)
Install this with bower or npm.
bower install y-indexeddb --save
npm install y-indexeddb --save
Y({
db: {
name: 'indexeddb'
},
connector: {
name: 'websockets-client', // choose the websockets connector
// name: 'webrtc'
// name: 'xmpp'
room: 'Textarea-example-dev'
},
sourceDir: '/bower_components', // location of the y-* modules
share: {
textarea: 'Text' // y.share.textarea is of type Y.Text
}
// types: ['Richtext', 'Array'] // optional list of types you want to import
}).then(function (y) {
// bind the textarea to a shared text element
y.share.textarea.bind(document.getElementById('textfield'))
}
Yjs is licensed under the MIT License.