mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 04:48:53 +00:00
## Features - https://github.com/toeverything/BlockSuite/pull/6728 @fundon - https://github.com/toeverything/BlockSuite/pull/6714 @doouding - https://github.com/toeverything/BlockSuite/pull/6733 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6560 @golok727 - https://github.com/toeverything/BlockSuite/pull/6727 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6645 @regischen - https://github.com/toeverything/BlockSuite/pull/6724 @fundon - https://github.com/toeverything/BlockSuite/pull/6719 @zzj3720 - https://github.com/toeverything/BlockSuite/pull/6682 @donteatfriedrice ## Bugfix - https://github.com/toeverything/BlockSuite/pull/6734 @Flrande - https://github.com/toeverything/BlockSuite/pull/6732 @fourdim - https://github.com/toeverything/BlockSuite/pull/6726 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6721 @Flrande - https://github.com/toeverything/BlockSuite/pull/6725 @fundon - https://github.com/toeverything/BlockSuite/pull/6716 @golok727 - https://github.com/toeverything/BlockSuite/pull/6723 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/6722 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6718 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/6702 @Tzyito - https://github.com/toeverything/BlockSuite/pull/6711 @Tzyito - https://github.com/toeverything/BlockSuite/pull/6694 @fundon - https://github.com/toeverything/BlockSuite/pull/6717 @golok727 ## Refactor - https://github.com/toeverything/BlockSuite/pull/6672 @Saul-Mirone ## Misc - https://github.com/toeverything/BlockSuite/pull/6720 @raintoway
@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);
}
});