From 635f39ddd01b2aba615c8e5c4c7dffdc7d73db9a Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Wed, 17 Jan 2024 11:31:16 +0100 Subject: [PATCH] do an environment test for nodejs - fixes #166 --- src/y-websocket.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/y-websocket.js b/src/y-websocket.js index 9c72a88..f68fb21 100644 --- a/src/y-websocket.js +++ b/src/y-websocket.js @@ -15,6 +15,7 @@ import * as awarenessProtocol from 'y-protocols/awareness' import { Observable } from 'lib0/observable' import * as math from 'lib0/math' import * as url from 'lib0/url' +import * as env from 'lib0/environment' export const messageSync = 0 export const messageQueryAwareness = 3 @@ -357,7 +358,7 @@ export class WebsocketProvider extends Observable { 'app closed' ) } - if (typeof process !== 'undefined') { + if (env.isNode && typeof process !== 'undefined') { process.on('exit', this._exitHandler) } awareness.on('update', this._awarenessUpdateHandler)