mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 20:38:52 +00:00
## Features - https://github.com/toeverything/BlockSuite/pull/6809 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6787 @Flrande - https://github.com/toeverything/BlockSuite/pull/6774 @donteatfriedrice ## Bugfix - https://github.com/toeverything/BlockSuite/pull/6817 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/6811 @regischen - https://github.com/toeverything/BlockSuite/pull/6814 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6813 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/6812 @doouding - https://github.com/toeverything/BlockSuite/pull/6815 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/6808 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/6804 @regischen - https://github.com/toeverything/BlockSuite/pull/6797 @regischen - https://github.com/toeverything/BlockSuite/pull/6802 @Saul-Mirone - https://github.com/toeverything/BlockSuite/pull/6801 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/6798 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6795 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6790 @lawvs - https://github.com/toeverything/BlockSuite/pull/6778 @zkwolf - https://github.com/toeverything/BlockSuite/pull/6792 @fundon ## Refactor ## Misc - https://github.com/toeverything/BlockSuite/pull/6807 @c0sc0s - https://github.com/toeverything/BlockSuite/pull/6806 @Saul-Mirone - https://github.com/toeverything/BlockSuite/pull/6800 @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);
}
});