Skip to content

Commit

Permalink
Merge pull request #3 from skyway/v1.0.1
Browse files Browse the repository at this point in the history
V1.0.1
  • Loading branch information
riosu authored Sep 11, 2017
2 parents 3bf150e + db84b3f commit cd57241
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
5 changes: 4 additions & 1 deletion examples/p2p-textchat/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
5 changes: 1 addition & 4 deletions src/peer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit cd57241

Please sign in to comment.