mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
## Features - https://github.com/toeverything/BlockSuite/pull/6379 @doodlewind - https://github.com/toeverything/BlockSuite/pull/6375 @doodlewind - https://github.com/toeverything/BlockSuite/pull/6370 @donteatfriedrice ## Bugfix - https://github.com/toeverything/BlockSuite/pull/6380 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/6377 @doouding - https://github.com/toeverything/BlockSuite/pull/6376 @fourdim - https://github.com/toeverything/BlockSuite/pull/6374 @regischen ## Misc - docs: update examples desc - ci: start publishing 0.13 canary
@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);
}
});