snowflake/proxy/shims.js
Arlo Breault fab39ae57c Cleanup lints identified by eslint
Some files were omitted in the .eslintignore, left as an exercise to the
reader.

We probably want to reduce amount of globals overall and use proper es
modules.
2019-07-10 10:58:29 +02:00

30 lines
983 B
JavaScript

/* global module, require */
/*
WebRTC shims for multiple browsers.
*/
if (typeof module !== "undefined" && module !== null ? module.exports : void 0) {
window = {};
document = {
getElementById: function() {
return null;
}
};
chrome = {};
location = { search: '' };
if ((typeof TESTING === "undefined" || TESTING === null) || !TESTING) {
webrtc = require('wrtc');
PeerConnection = webrtc.RTCPeerConnection;
IceCandidate = webrtc.RTCIceCandidate;
SessionDescription = webrtc.RTCSessionDescription;
WebSocket = require('ws');
({ XMLHttpRequest } = require('xmlhttprequest'));
}
} else {
PeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
IceCandidate = window.RTCIceCandidate || window.mozRTCIceCandidate;
SessionDescription = window.RTCSessionDescription || window.mozRTCSessionDescription;
WebSocket = window.WebSocket;
XMLHttpRequest = window.XMLHttpRequest;
}