mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 17:46:18 +08:00
64b017dc1b
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`
38 lines
944 B
TypeScript
38 lines
944 B
TypeScript
import { dialogHandlers } from './dialog';
|
|
import { dbEventsV1, dbHandlersV1, nbstoreHandlers } from './nbstore';
|
|
import { provideExposed } from './provide';
|
|
import { workspaceEvents, workspaceHandlers } from './workspace';
|
|
|
|
export const handlers = {
|
|
db: dbHandlersV1,
|
|
nbstore: nbstoreHandlers,
|
|
workspace: workspaceHandlers,
|
|
dialog: dialogHandlers,
|
|
};
|
|
|
|
export const events = {
|
|
db: dbEventsV1,
|
|
workspace: workspaceEvents,
|
|
};
|
|
|
|
const getExposedMeta = () => {
|
|
const handlersMeta = Object.entries(handlers).map(
|
|
([namespace, namespaceHandlers]) => {
|
|
return [namespace, Object.keys(namespaceHandlers)] as [string, string[]];
|
|
}
|
|
);
|
|
|
|
const eventsMeta = Object.entries(events).map(
|
|
([namespace, namespaceHandlers]) => {
|
|
return [namespace, Object.keys(namespaceHandlers)] as [string, string[]];
|
|
}
|
|
);
|
|
|
|
return {
|
|
handlers: handlersMeta,
|
|
events: eventsMeta,
|
|
};
|
|
};
|
|
|
|
provideExposed(getExposedMeta());
|