peer-data
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -79,12 +79,10 @@ import { EventDispatcher } from './EventDispatcher'; | ||
}; | ||
var onDataChannel = function (event) { | ||
_this.connection.addChannel(mainEvent.caller.id, event.channel); | ||
peer.ondatachannel = function (event) { | ||
channel = event.channel; | ||
_this.connection.addChannel(mainEvent.caller.id, channel); | ||
if (peer.connectionState === 'connected') { | ||
resolve({ room: mainEvent.room, caller: mainEvent.caller, peer: peer, channel: channel }); | ||
} | ||
else { | ||
channel = event.channel; | ||
} | ||
}; | ||
var onConnectionStateChange = function (event) { | ||
peer.onconnectionstatechange = function (event) { | ||
if (peer.connectionState === 'connected' && channel) { | ||
@@ -94,4 +92,2 @@ resolve({ room: mainEvent.room, caller: mainEvent.caller, peer: peer, channel: channel }); | ||
}; | ||
peer.ondatachannel = onDataChannel; | ||
peer.onconnectionstatechange = onConnectionStateChange; | ||
peer | ||
@@ -136,7 +132,2 @@ .setRemoteDescription(new RTCSessionDescription(mainEvent.data)) | ||
_this.connection.addPeer(mainEvent.caller.id, peer); | ||
var onConnectionStateChange = function (event) { | ||
if (peer.connectionState === 'connected') { | ||
resolve({ room: mainEvent.room, caller: mainEvent.caller, peer: peer, channel: channel }); | ||
} | ||
}; | ||
var onCandidate = function (event) { | ||
@@ -158,3 +149,7 @@ if (mainEvent.caller.id !== event.caller.id) { | ||
}; | ||
peer.onconnectionstatechange = onConnectionStateChange; | ||
peer.onconnectionstatechange = function (event) { | ||
if (peer.connectionState === 'connected') { | ||
resolve({ room: mainEvent.room, caller: mainEvent.caller, peer: peer, channel: channel }); | ||
} | ||
}; | ||
peer | ||
@@ -161,0 +156,0 @@ .createOffer() |
@@ -81,12 +81,10 @@ "use strict"; | ||
}; | ||
var onDataChannel = function (event) { | ||
_this.connection.addChannel(mainEvent.caller.id, event.channel); | ||
peer.ondatachannel = function (event) { | ||
channel = event.channel; | ||
_this.connection.addChannel(mainEvent.caller.id, channel); | ||
if (peer.connectionState === 'connected') { | ||
resolve({ room: mainEvent.room, caller: mainEvent.caller, peer: peer, channel: channel }); | ||
} | ||
else { | ||
channel = event.channel; | ||
} | ||
}; | ||
var onConnectionStateChange = function (event) { | ||
peer.onconnectionstatechange = function (event) { | ||
if (peer.connectionState === 'connected' && channel) { | ||
@@ -96,4 +94,2 @@ resolve({ room: mainEvent.room, caller: mainEvent.caller, peer: peer, channel: channel }); | ||
}; | ||
peer.ondatachannel = onDataChannel; | ||
peer.onconnectionstatechange = onConnectionStateChange; | ||
peer | ||
@@ -138,7 +134,2 @@ .setRemoteDescription(new RTCSessionDescription(mainEvent.data)) | ||
_this.connection.addPeer(mainEvent.caller.id, peer); | ||
var onConnectionStateChange = function (event) { | ||
if (peer.connectionState === 'connected') { | ||
resolve({ room: mainEvent.room, caller: mainEvent.caller, peer: peer, channel: channel }); | ||
} | ||
}; | ||
var onCandidate = function (event) { | ||
@@ -160,3 +151,7 @@ if (mainEvent.caller.id !== event.caller.id) { | ||
}; | ||
peer.onconnectionstatechange = onConnectionStateChange; | ||
peer.onconnectionstatechange = function (event) { | ||
if (peer.connectionState === 'connected') { | ||
resolve({ room: mainEvent.room, caller: mainEvent.caller, peer: peer, channel: channel }); | ||
} | ||
}; | ||
peer | ||
@@ -163,0 +158,0 @@ .createOffer() |
{ | ||
"name": "peer-data", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "PeerData - library for files, media streaming/sharing using WebRTC", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
432378
1454