Set internal connected flag before emitting event

This commit is contained in:
Paul Kaplan 2018-07-10 15:57:25 -04:00
parent e156b0536c
commit 82a33691d3
2 changed files with 2 additions and 2 deletions

View file

@ -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 => {

View file

@ -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 => {