/js/lib/Socket.IO-node/support/socket.io-client/lib/transports/xhr-multipart.js
JavaScript | 37 lines | 22 code | 8 blank | 7 comment | 4 complexity | 10d6cc1c17e5a307b7518a4fa2384a3b MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, BSD-3-Clause
1/** 2 * Socket.IO client 3 * 4 * @author Guillermo Rauch <guillermo@learnboost.com> 5 * @license The MIT license. 6 * @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com> 7 */ 8 9(function(){ 10 var io = this.io; 11 12 var XHRMultipart = io.Transport['xhr-multipart'] = function(){ 13 io.Transport.XHR.apply(this, arguments); 14 }; 15 16 io.util.inherit(XHRMultipart, io.Transport.XHR); 17 18 XHRMultipart.prototype.type = 'xhr-multipart'; 19 20 XHRMultipart.prototype._get = function(){ 21 var self = this; 22 this._xhr = this._request('', 'GET', true); 23 this._xhr.onreadystatechange = function(){ 24 if (self._xhr.readyState == 4) self._onData(self._xhr.responseText); 25 }; 26 this._xhr.send(null); 27 }; 28 29 XHRMultipart.check = function(){ 30 return 'XMLHttpRequest' in window && 'prototype' in XMLHttpRequest && 'multipart' in XMLHttpRequest.prototype; 31 }; 32 33 XHRMultipart.xdomainCheck = function(){ 34 return true; 35 }; 36 37})();