Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/*jslint indent:2,sloppy:true, node:true */
var adapter = require('webrtc-adapter');
var PromiseCompat = require('es6-promise').Promise;
var RTCPeerConnection = adapter.RTCPeerConnection;
var RTCSessionDescription = adapter.RTCSessionDescription;
var RTCIceCandidate = adapter.RTCIceCandidate;
var DataChannel = require('./core.rtcdatachannel');
var RTCPeerConnectionAdapter = function (cap, dispatchEvent, configuration) {
this.dispatchEvent = dispatchEvent;
try {
this.connection = new RTCPeerConnection(configuration);
} catch (e) {
// Note: You can't ask the provider to close you synchronously, since
// the constructor has not yet returned, so there's no 'this' that
// the provider can know about yet.
setTimeout(cap.provider.close.bind(cap.provider, this), 0);
return;
}