mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
## Features - https://github.com/toeverything/BlockSuite/pull/6825 @regischen ## Bugfix - https://github.com/toeverything/BlockSuite/pull/6828 @regischen - https://github.com/toeverything/BlockSuite/pull/6823 @fundon - https://github.com/toeverything/BlockSuite/pull/6822 @fundon - https://github.com/toeverything/BlockSuite/pull/6826 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6794 @fundon - https://github.com/toeverything/BlockSuite/pull/6821 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/6781 @doouding - https://github.com/toeverything/BlockSuite/pull/6820 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6819 @regischen - https://github.com/toeverything/BlockSuite/pull/6817 @donteatfriedrice ## Refactor ## Misc
@toeverything/y-indexeddb
Features
- persistence data in indexeddb
- sub-documents support
- fully TypeScript
Usage
import { createIndexedDBProvider, downloadBinary } from '@toeverything/y-indexeddb';
import * as Y from 'yjs';
const yDoc = new Y.Doc({
// we use `guid` as unique key
guid: 'my-doc',
});
// sync yDoc with indexedDB
const provider = createIndexedDBProvider(yDoc);
provider.connect();
await provider.whenSynced.then(() => {
console.log('synced');
provider.disconnect();
});
// dowload binary data from indexedDB for once
downloadBinary(yDoc.guid).then(blob => {
if (blob !== false) {
Y.applyUpdate(yDoc, blob);
}
});