mirror of
https://github.com/JustKato/FreePad.git
synced 2026-04-06 03:48:47 +03:00
* Removed deprecated variable
This commit is contained in:
@@ -2,10 +2,6 @@ class PadSocket {
|
|||||||
|
|
||||||
ws = null;
|
ws = null;
|
||||||
padName = null;
|
padName = null;
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
state = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PadSocket
|
* Create a new PadSocket
|
||||||
@@ -22,10 +18,6 @@ class PadSocket {
|
|||||||
|
|
||||||
// Connect to the websocket
|
// Connect to the websocket
|
||||||
const ws = new WebSocket(connUrl);
|
const ws = new WebSocket(connUrl);
|
||||||
ws.onopen = () => {
|
|
||||||
// TODO: This is redundant, we could check the websocket status: ws.readyState == WebSocket.OPEN
|
|
||||||
this.state = 'active';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bind the onMessage function
|
// Bind the onMessage function
|
||||||
ws.onmessage = this.handleMessage;
|
ws.onmessage = this.handleMessage;
|
||||||
@@ -43,7 +35,7 @@ class PadSocket {
|
|||||||
*/
|
*/
|
||||||
sendMessage = (eventType, message) => {
|
sendMessage = (eventType, message) => {
|
||||||
|
|
||||||
if ( this.state != 'active' ) {
|
if ( this.ws.readyState !== WebSocket.OPEN ) {
|
||||||
throw new Error(`The websocket connection is not active`);
|
throw new Error(`The websocket connection is not active`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user