From 82a33691d3e3bca24536d27d61812ff5772fc4bb Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Tue, 10 Jul 2018 15:57:25 -0400 Subject: [PATCH] Set internal connected flag before emitting event --- src/io/bleSession.js | 2 +- src/io/btSession.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/io/bleSession.js b/src/io/bleSession.js index 1596c721a..a77f6298a 100644 --- a/src/io/bleSession.js +++ b/src/io/bleSession.js @@ -51,8 +51,8 @@ class BLESession extends JSONRPCWebSocket { this.sendRemoteRequest('connect', {peripheralId: id}) .then(() => { log.info('should have connected'); - this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED); this._connected = true; + this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED); this._connectCallback(); }) .catch(e => { diff --git a/src/io/btSession.js b/src/io/btSession.js index bf847296e..08df20085 100644 --- a/src/io/btSession.js +++ b/src/io/btSession.js @@ -53,8 +53,8 @@ class BTSession extends JSONRPCWebSocket { this.sendRemoteRequest('connect', {peripheralId: id}) .then(() => { log.info('should have connected'); - this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED); this._connected = true; + this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED); this._connectCallback(); }) .catch(e => {