* Closes the sync client and cleans up all resources. * * Call this method when you no longer need the sync client to prevent * memory leaks and close the WebSocket connection. After calling close(), * the client cannot be reused. * * @example * ```ts * // Clean shutdown * syncClie
()
| 821 | * ``` |
| 822 | */ |
| 823 | close() { |
| 824 | this.debug('closing') |
| 825 | this.disposables.forEach((dispose) => dispose()) |
| 826 | this.sendUnsentChanges.cancel?.() |
| 827 | this.scheduleRebase.cancel?.() |
| 828 | if (typeof window !== 'undefined' && (window as any).tlsync === this) { |
| 829 | delete (window as any).tlsync |
| 830 | } |
| 831 | } |
| 832 | |
| 833 | private lastPushedPresenceState: R | null = null |
| 834 |