UNPKG

emailjs-tcp-socket

Version:

This shim brings the W3C Raw Socket API to node.js and Chromium. Its purpose is to enable apps to use the same api in Firefox OS, Chrome OS, and on the server.

22 lines (18 loc) 686 B
let TCPSocket class DummySocket { static open () { throw new Error('Runtime does not offer raw sockets!') } } if (typeof process !== 'undefined') { TCPSocket = require('./node-socket') } else if (typeof chrome !== 'undefined' && (chrome.socket || chrome.sockets)) { TCPSocket = require('./chrome-socket') } else if (typeof Windows === 'object' && Windows && Windows.Networking && Windows.Networking.Sockets && Windows.Networking.Sockets.StreamSocket) { TCPSocket = require('./windows-socket') } else if (typeof window === 'object' && typeof io === 'function') { TCPSocket = require('./socketio-socket') } else { TCPSocket = DummySocket } module.exports = TCPSocket