mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 04:48:53 +00:00
## Features - https://github.com/toeverything/BlockSuite/pull/6763 @doouding - https://github.com/toeverything/BlockSuite/pull/6780 @Saul-Mirone - https://github.com/toeverything/BlockSuite/pull/6775 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6765 @donteatfriedrice ## Bugfix - https://github.com/toeverything/BlockSuite/pull/6792 @fundon - https://github.com/toeverything/BlockSuite/pull/6791 @fundon - https://github.com/toeverything/BlockSuite/pull/6776 @fundon - https://github.com/toeverything/BlockSuite/pull/6779 @Flrande - https://github.com/toeverything/BlockSuite/pull/6771 @fundon - https://github.com/toeverything/BlockSuite/pull/6769 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/6768 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6758 @Flrande - https://github.com/toeverything/BlockSuite/pull/6743 @fourdim - https://github.com/toeverything/BlockSuite/pull/6762 @regischen ## Refactor - https://github.com/toeverything/BlockSuite/pull/6786 @regischen - https://github.com/toeverything/BlockSuite/pull/6764 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6772 @fundon ## Misc - https://github.com/toeverything/BlockSuite/pull/6766 @fourdim
@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);
}
});