mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
feat(core): new worker workspace engine (#9257)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { Slot } from '@blocksuite/global/utils';
|
||||
import type { BlobEngine } from '@blocksuite/sync';
|
||||
import type { Awareness } from 'y-protocols/awareness.js';
|
||||
import type * as Y from 'yjs';
|
||||
|
||||
import type { Schema } from '../schema/schema.js';
|
||||
@@ -15,6 +16,8 @@ export interface Workspace {
|
||||
readonly idGenerator: IdGenerator;
|
||||
readonly blobSync: BlobEngine;
|
||||
readonly awarenessStore: AwarenessStore;
|
||||
readonly onLoadDoc?: (doc: Y.Doc) => void;
|
||||
readonly onLoadAwareness?: (awareness: Awareness) => void;
|
||||
|
||||
get schema(): Schema;
|
||||
get doc(): Y.Doc;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import { diffUpdate, encodeStateVectorFromUpdate, mergeUpdates } from 'yjs';
|
||||
|
||||
import { MANUALLY_STOP } from '../../utils/throw-if-aborted.js';
|
||||
import type { DocSource } from '../source.js';
|
||||
|
||||
type ChannelMessage =
|
||||
@@ -85,7 +86,7 @@ export class BroadcastChannelDocSource implements DocSource {
|
||||
{ signal: abortController.signal }
|
||||
);
|
||||
return () => {
|
||||
abortController.abort();
|
||||
abortController.abort(MANUALLY_STOP);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user