From 6142c3baec3149f6f911ebdf7028503e526b127d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Fri, 29 Jan 2021 20:13:37 +0100 Subject: [PATCH] websocket supported getter. --- src/component/internal/websocket.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/component/internal/websocket.ts b/src/component/internal/websocket.ts index 9e95b932..23553d12 100644 --- a/src/component/internal/websocket.ts +++ b/src/component/internal/websocket.ts @@ -21,6 +21,10 @@ export class NekoWebSocket extends EventEmitter { 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 }