Skip to content

Commit

Permalink
host: handle a second client connecting later
Browse files Browse the repository at this point in the history
We don't have a way to unregister from events, so, check if _isConnected
  • Loading branch information
omsmith committed Dec 18, 2017
1 parent 35cd906 commit 220943a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/host.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 220943a

Please sign in to comment.