From 07bcb81b9a6f9039efa031acad0435b956d98f43 Mon Sep 17 00:00:00 2001 From: Alan Iida Date: Thu, 7 Sep 2017 16:21:08 +0900 Subject: [PATCH 1/2] move dc connection event outside of open this way we can always catch dc.on('open') events --- examples/p2p-textchat/script.js | 5 ++++- src/peer.js | 5 +---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/p2p-textchat/script.js b/examples/p2p-textchat/script.js index 483ed6fe..41f4db17 100644 --- a/examples/p2p-textchat/script.js +++ b/examples/p2p-textchat/script.js @@ -21,7 +21,10 @@ $(function() { $('#pid').text(id); }); // Await connections from others - peer.on('connection', connect); + peer.on('connection', c => { + // Show connection when it is completely ready + c.on('open', () => connect(c)); + }); peer.on('error', err => console.log(err)); // Prepare file drop box. diff --git a/src/peer.js b/src/peer.js index a31754f7..6b20ed1b 100644 --- a/src/peer.js +++ b/src/peer.js @@ -555,11 +555,8 @@ class Peer extends EventEmitter { logger.log('DataConnection created in OFFER'); - // _addConnection() needs to be outside of the open event or else open won't fire. this._addConnection(offerMessage.src, connection); - connection.on(DataConnection.EVENTS.open.key, () => { - this.emit(Peer.EVENTS.connection.key, connection); - }); + this.emit(Peer.EVENTS.connection.key, connection); } else { logger.warn('Received malformed connection type: ', offerMessage.connectionType); } From db84b3f1b6960606c9a3f056f4c4d3cd9cfef34d Mon Sep 17 00:00:00 2001 From: Alan Iida Date: Mon, 11 Sep 2017 12:23:54 +0900 Subject: [PATCH 2/2] Update to v1.0.1 and add changelog --- CHANGELOG.md | 11 +++++++++++ package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..53704d66 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog + +## [v1.0.1](https://github.com/skyway/skyway-js-sdk/releases/tag/v1.0.1) - 2017-09-11 + +### Added + +- Change log + +### Fixed + +- Change timing of DataConnection 'open' event so that it can always be caught. ([PR #1](https://github.com/skyway/skyway-js-sdk/pull/1)) diff --git a/package.json b/package.json index f3be2850..04e58e4f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "skyway", - "version": "1.0.0", + "version": "1.0.1", "description": "The JS client library for SkyWay", "main": "dist/skyway.js", "module": "src/peer.js",