mirror of
				https://github.com/fooflington/selfdefined.git
				synced 2025-11-03 23:29:03 +00:00 
			
		
		
		
	update
This commit is contained in:
		
							
								
								
									
										53
									
								
								node_modules/engine.io-client/lib/transports/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										53
									
								
								node_modules/engine.io-client/lib/transports/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Executable file
									
								
							@@ -0,0 +1,53 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Module dependencies
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
var XMLHttpRequest = require('xmlhttprequest-ssl');
 | 
			
		||||
var XHR = require('./polling-xhr');
 | 
			
		||||
var JSONP = require('./polling-jsonp');
 | 
			
		||||
var websocket = require('./websocket');
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Export transports.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
exports.polling = polling;
 | 
			
		||||
exports.websocket = websocket;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Polling transport polymorphic constructor.
 | 
			
		||||
 * Decides on xhr vs jsonp based on feature detection.
 | 
			
		||||
 *
 | 
			
		||||
 * @api private
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
function polling (opts) {
 | 
			
		||||
  var xhr;
 | 
			
		||||
  var xd = false;
 | 
			
		||||
  var xs = false;
 | 
			
		||||
  var jsonp = false !== opts.jsonp;
 | 
			
		||||
 | 
			
		||||
  if (typeof location !== 'undefined') {
 | 
			
		||||
    var isSSL = 'https:' === location.protocol;
 | 
			
		||||
    var port = location.port;
 | 
			
		||||
 | 
			
		||||
    // some user agents have empty `location.port`
 | 
			
		||||
    if (!port) {
 | 
			
		||||
      port = isSSL ? 443 : 80;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    xd = opts.hostname !== location.hostname || port !== opts.port;
 | 
			
		||||
    xs = opts.secure !== isSSL;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  opts.xdomain = xd;
 | 
			
		||||
  opts.xscheme = xs;
 | 
			
		||||
  xhr = new XMLHttpRequest(opts);
 | 
			
		||||
 | 
			
		||||
  if ('open' in xhr && !opts.forceJSONP) {
 | 
			
		||||
    return new XHR(opts);
 | 
			
		||||
  } else {
 | 
			
		||||
    if (!jsonp) throw new Error('JSONP disabled');
 | 
			
		||||
    return new JSONP(opts);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user