feat(nbstore): remove async on connection api (#9187)

We should not use async on `connect` and `disconnect`, for `WebSocketConnection` will never connect when offline.

We should handle the connection status of each storage in sync, using the `connection.waitForConnect`

This PR also puts the connection reference count on the `connect` and disconnect`
This commit is contained in:
EYHN
2024-12-18 03:59:49 +00:00
parent 3fddf050a4
commit 64b017dc1b
20 changed files with 160 additions and 226 deletions
+1 -2
View File
@@ -1,4 +1,3 @@
import { share } from '../../connection';
import {
type DocClock,
type DocClocks,
@@ -17,7 +16,7 @@ interface ChannelMessage {
}
export class IndexedDBDocStorage extends DocStorage {
readonly connection = share(new IDBConnection(this.options));
readonly connection = new IDBConnection(this.options);
get db() {
return this.connection.inner.db;