IndexedDB database adapter for Yjs
npm install y-indexeddb> IndexedDB database provider for Yjs. Documentation
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
You find the complete documentation published online: API documentation.
``sh`
npm i --save y-indexeddb
`js
const provider = new IndexeddbPersistence(docName, ydoc)
provider.on('synced', () => {
console.log('content from the database is loaded')
})
``
provider = new IndexeddbPersistence(docName: string, ydoc: Y.Doc)provider.on('synced', function(idbPersistence: IndexeddbPersistence))provider.set(key: any, value: any): Promise<any>provider.get(key: any): Promise>any<provider.del(key: any): Promise>undefined<provider.destroy(): Promiseprovider.clearData(): PromiseYjs is licensed under the MIT License.