mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
## Features - https://github.com/toeverything/BlockSuite/pull/6863 @regischen - https://github.com/toeverything/BlockSuite/pull/6852 @doouding - https://github.com/toeverything/BlockSuite/pull/6860 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6856 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/6849 @fundon ## Bugfix - https://github.com/toeverything/BlockSuite/pull/6873 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6870 @golok727 - https://github.com/toeverything/BlockSuite/pull/6851 @golok727 - https://github.com/toeverything/BlockSuite/pull/6848 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6847 @fundon - https://github.com/toeverything/BlockSuite/pull/6867 @EYHN - https://github.com/toeverything/BlockSuite/pull/6868 @fundon - https://github.com/toeverything/BlockSuite/pull/6869 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/6865 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/6866 @fundon - https://github.com/toeverything/BlockSuite/pull/6864 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/6824 @undefined - https://github.com/toeverything/BlockSuite/pull/6859 @fundon - https://github.com/toeverything/BlockSuite/pull/6853 @fundon - https://github.com/toeverything/BlockSuite/pull/6854 @fundon - https://github.com/toeverything/BlockSuite/pull/6845 @fourdim ## Refactor - https://github.com/toeverything/BlockSuite/pull/6872 @fundon ## 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);
}
});