@hocuspocus/provider
Advanced tools
Comparing version 2.13.0 to 2.13.1
@@ -92,3 +92,3 @@ import * as mutex from 'lib0/mutex'; | ||
boundBroadcastChannelSubscriber: (data: ArrayBuffer) => void; | ||
boundPageUnload: () => void; | ||
boundPageHide: () => void; | ||
boundOnOpen: (event: Event) => Promise<void>; | ||
@@ -107,6 +107,7 @@ boundOnClose: (event: CloseEvent) => void; | ||
get hasUnsyncedChanges(): boolean; | ||
private resetUnsyncedChanges; | ||
incrementUnsyncedChanges(): void; | ||
decrementUnsyncedChanges(): void; | ||
forceSync(): void; | ||
pageUnload(): void; | ||
pageHide(): void; | ||
registerEventListeners(): void; | ||
@@ -113,0 +114,0 @@ sendStateless(payload: string): void; |
{ | ||
"name": "@hocuspocus/provider", | ||
"version": "2.13.0", | ||
"version": "2.13.1", | ||
"description": "hocuspocus provider", | ||
@@ -32,3 +32,3 @@ "homepage": "https://hocuspocus.dev", | ||
"dependencies": { | ||
"@hocuspocus/common": "^2.13.0", | ||
"@hocuspocus/common": "^2.13.1", | ||
"@lifeomic/attempt": "^3.0.2", | ||
@@ -35,0 +35,0 @@ "lib0": "^0.2.87", |
@@ -234,3 +234,3 @@ import { awarenessStatesToArray } from '@hocuspocus/common' | ||
boundPageUnload = this.pageUnload.bind(this) | ||
boundPageHide = this.pageHide.bind(this) | ||
@@ -286,2 +286,7 @@ boundOnOpen = this.onOpen.bind(this) | ||
private resetUnsyncedChanges() { | ||
this.unsyncedChanges = 1 | ||
this.emit('unsyncedChanges', this.unsyncedChanges) | ||
} | ||
incrementUnsyncedChanges() { | ||
@@ -301,8 +306,10 @@ this.unsyncedChanges += 1 | ||
forceSync() { | ||
this.resetUnsyncedChanges() | ||
this.send(SyncStepOneMessage, { document: this.document, documentName: this.configuration.name }) | ||
} | ||
pageUnload() { | ||
pageHide() { | ||
if (this.awareness) { | ||
removeAwarenessStates(this.awareness, [this.document.clientID], 'window unload') | ||
removeAwarenessStates(this.awareness, [this.document.clientID], 'page hide') | ||
} | ||
@@ -316,3 +323,3 @@ } | ||
window.addEventListener('unload', this.boundPageUnload) | ||
window.addEventListener('pagehide', this.boundPageHide) | ||
} | ||
@@ -371,3 +378,3 @@ | ||
// not needed, but provides backward compatibility with e.g. lexicla/yjs | ||
// not needed, but provides backward compatibility with e.g. lexical/yjs | ||
async connect() { | ||
@@ -428,3 +435,4 @@ if (this.configuration.broadcast) { | ||
startSync() { | ||
this.incrementUnsyncedChanges() | ||
this.resetUnsyncedChanges() | ||
this.send(SyncStepOneMessage, { document: this.document, documentName: this.configuration.name }) | ||
@@ -519,3 +527,3 @@ | ||
window.removeEventListener('unload', this.boundPageUnload) | ||
window.removeEventListener('pagehide', this.boundPageHide) | ||
} | ||
@@ -522,0 +530,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
822095
9376
Updated@hocuspocus/common@^2.13.1