websocket supported getter.

This commit is contained in:
Miroslav Šedivý 2021-01-29 20:13:37 +01:00
parent 54f7514336
commit 6142c3baec

View File

@ -21,6 +21,10 @@ export class NekoWebSocket extends EventEmitter<NekoWebSocketEvents> {
this._log = new Logger('websocket')
}
get supported() {
return typeof WebSocket !== 'undefined' && WebSocket.OPEN === 1
}
get connected() {
return typeof this._ws !== 'undefined' && this._ws.readyState === WebSocket.OPEN
}