From 220943ac5e3c6167dd6356679a4d11ea823f2aa3 Mon Sep 17 00:00:00 2001 From: Owen Smith Date: Mon, 18 Dec 2017 18:49:55 -0500 Subject: [PATCH] host: handle a second client connecting later We don't have a way to unregister from events, so, check if _isConnected --- src/host.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/host.js b/src/host.js index 1714a1c..3211ba7 100644 --- a/src/host.js +++ b/src/host.js @@ -56,6 +56,10 @@ Host.prototype.connect = function connect() { var me = this; return new Promise(function(resolve/*, reject*/) { me.onEvent('ready', function() { + if (me._isConnected) { + return; + } + resolve(Port.prototype.connect.call(me)); }); me.open();