@@ -16,6 +16,7 @@ import * as syncProtocol from 'y-protocols/sync';
1616import * as Y from 'yjs' ;
1717
1818import { MESSAGE_AWARENESS_CODE , MESSAGE_SYNC_CODE } from './constants' ;
19+ import { PageItemService } from './page.service' ;
1920
2021const wsReadyStateConnecting = 0 ;
2122const wsReadyStateOpen = 1 ;
@@ -25,18 +26,21 @@ const wsReadyStateOpen = 1;
2526 * Broadcast updates to attached connections
2627 */
2728export class WSDoc extends Y . Doc {
28- name : string ;
29- conns : Map < WebSocket , Set < number > > ;
30- enableAwareness : boolean ;
31- awareness : awarenessProtocol . Awareness ;
29+ public awareness : awarenessProtocol . Awareness ;
30+ public conns : Map < WebSocket , Set < number > > ;
3231
33- constructor ( name : string , enableAwareness : boolean ) {
32+ protected name : string ;
33+ protected enableAwareness : boolean ;
34+ protected pageItemService : PageItemService ;
35+
36+ constructor ( pageItemService : PageItemService , name : string , enableAwareness : boolean ) {
3437 super ( ) ;
3538 this . name = name ;
3639 this . conns = new Map ( ) ;
3740 this . enableAwareness = enableAwareness ;
3841 this . awareness = new awarenessProtocol . Awareness ( this ) ;
3942 this . awareness . setLocalState ( null ) ;
43+ this . pageItemService = pageItemService ;
4044 }
4145
4246 protected broadcastUpdate ( update : Uint8Array ) {
0 commit comments