do an environment test for nodejs - fixes #166

This commit is contained in:
Kevin Jahns 2024-01-17 11:31:16 +01:00
parent ff511896f2
commit 635f39ddd0

View File

@ -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)