mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-11 14:08:55 +08:00
chore: improve docs
This commit is contained in:
@@ -51,9 +51,7 @@ export class AffineProvider extends LocalProvider {
|
||||
if (this._onTokenRefresh) {
|
||||
token.offChange(this._onTokenRefresh);
|
||||
}
|
||||
if (this._ws) {
|
||||
this._ws.disconnect();
|
||||
}
|
||||
this._ws?.disconnect();
|
||||
}
|
||||
|
||||
async initData() {
|
||||
@@ -72,9 +70,8 @@ export class AffineProvider extends LocalProvider {
|
||||
doc.once('update', resolve);
|
||||
applyUpdate(doc, new Uint8Array(updates));
|
||||
});
|
||||
// TODO: wait util data loaded
|
||||
this._ws = new WebsocketProvider('/', workspace.room, doc);
|
||||
// Wait for ws synchronization to complete, otherwise the data will be modified in reverse, which can be optimized later
|
||||
this._ws = new WebsocketProvider('/', workspace.room, doc);
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
// TODO: synced will also be triggered on reconnection after losing sync
|
||||
// There needs to be an event mechanism to emit the synchronization state to the upper layer
|
||||
|
||||
@@ -36,14 +36,12 @@ export class LocalProvider extends BaseProvider {
|
||||
async clear() {
|
||||
await super.clear();
|
||||
await this._blobs.clear();
|
||||
this._idb?.clearData();
|
||||
await this._idb?.clearData();
|
||||
}
|
||||
|
||||
async destroy(): Promise<void> {
|
||||
super.destroy();
|
||||
if (this._idb) {
|
||||
await this._idb.destroy();
|
||||
}
|
||||
await this._idb?.destroy();
|
||||
}
|
||||
|
||||
async getBlob(id: string): Promise<string | null> {
|
||||
|
||||
Reference in New Issue
Block a user