mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-23 04:51:49 +08:00
docs(y-indexeddb): add README.md (#1886)
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# @toeverything/y-indexeddb
|
||||
|
||||
> This package haven't been published yet.
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import { createIndexedDBProvider } from '@toeverything/y-indexeddb';
|
||||
import * as Y from 'yjs';
|
||||
const yDoc = new Y.Doc();
|
||||
|
||||
const provider = createIndexedDBProvider('docName', yDoc);
|
||||
provider.connect();
|
||||
await provider.whenSynced.then(() => {
|
||||
console.log('synced');
|
||||
provider.disconnect();
|
||||
});
|
||||
```
|
||||
Reference in New Issue
Block a user