mirror of
https://github.com/aljazceru/meshcore-web.git
synced 2025-12-17 16:24:18 +01:00
do nothing if connection not provided
This commit is contained in:
@@ -48,9 +48,17 @@ class Connection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async connect(connection) {
|
static async connect(connection) {
|
||||||
|
|
||||||
|
// do nothing if connection not provided
|
||||||
|
if(!connection){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// update connection and listen for events
|
||||||
GlobalState.connection = connection;
|
GlobalState.connection = connection;
|
||||||
GlobalState.connection.on("connected", () => this.onConnected());
|
GlobalState.connection.on("connected", () => this.onConnected());
|
||||||
GlobalState.connection.on("disconnected", () => this.onDisconnected());
|
GlobalState.connection.on("disconnected", () => this.onDisconnected());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static async disconnect() {
|
static async disconnect() {
|
||||||
|
|||||||
Reference in New Issue
Block a user