File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { Mutex } from "async-mutex" ;
12import type WebSocket from "ws" ;
23import {
34 Awareness ,
4- removeAwarenessStates ,
55 applyAwarenessUpdate ,
6+ removeAwarenessStates ,
67} from "y-protocols/awareness" ;
7- import { applyUpdate , Doc , encodeStateAsUpdate } from "yjs" ;
8- import type { AwarenessUpdate } from "./types.ts" ;
8+ import { Doc , applyUpdate , encodeStateAsUpdate } from "yjs" ;
99import type Connection from "./Connection.ts" ;
1010import { OutgoingMessage } from "./OutgoingMessage.ts" ;
11- import { Mutex } from "async-mutex " ;
11+ import type { AwarenessUpdate } from "./types.ts " ;
1212
1313export class Document extends Doc {
1414 awareness : Awareness ;
@@ -42,6 +42,8 @@ export class Document extends Doc {
4242
4343 saveMutex = new Mutex ( ) ;
4444
45+ lastChangeTime = 0 ;
46+
4547 /**
4648 * Constructor.
4749 */
Original file line number Diff line number Diff line change @@ -382,6 +382,8 @@ export class Hocuspocus {
382382
383383 document . onUpdate (
384384 ( document : Document , connection : Connection , update : Uint8Array ) => {
385+ document . lastChangeTime = Date . now ( ) ;
386+
385387 this . handleDocumentUpdate (
386388 document ,
387389 connection ,
You can’t perform that action at this time.
0 commit comments