mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-14 00:26:51 +08:00
a440e85ffe
## Features - toeverything/blocksuite#6937 @Flrande ## Bugfix - toeverything/blocksuite#7137 @fundon - toeverything/blocksuite#7126 @golok727 - toeverything/blocksuite#7128 @CatsJuice - toeverything/blocksuite#7130 @fundon ## Refactor ## Misc - toeverything/blocksuite#7131 @fundon ## Additional changes Adjust the awareness provider so that it only obtains awareness instances when connect, and fixes the dependencies between workspace components.
19 lines
470 B
TypeScript
19 lines
470 B
TypeScript
import type { Awareness } from 'y-protocols/awareness.js';
|
|
|
|
export interface AwarenessConnection {
|
|
connect(awareness: Awareness): void;
|
|
disconnect(): void;
|
|
}
|
|
|
|
export class AwarenessEngine {
|
|
constructor(public readonly connections: AwarenessConnection[]) {}
|
|
|
|
connect(awareness: Awareness) {
|
|
this.connections.forEach(connection => connection.connect(awareness));
|
|
}
|
|
|
|
disconnect() {
|
|
this.connections.forEach(connection => connection.disconnect());
|
|
}
|
|
}
|