/js/lib/Socket.IO-node/support/socket.io-client/lib/transports/xhr-multipart.js
http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs · JavaScript · 37 lines · 22 code · 8 blank · 7 comment · 4 complexity · 10d6cc1c17e5a307b7518a4fa2384a3b MD5 · raw file
- /**
- * Socket.IO client
- *
- * @author Guillermo Rauch <guillermo@learnboost.com>
- * @license The MIT license.
- * @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com>
- */
- (function(){
- var io = this.io;
-
- var XHRMultipart = io.Transport['xhr-multipart'] = function(){
- io.Transport.XHR.apply(this, arguments);
- };
-
- io.util.inherit(XHRMultipart, io.Transport.XHR);
-
- XHRMultipart.prototype.type = 'xhr-multipart';
-
- XHRMultipart.prototype._get = function(){
- var self = this;
- this._xhr = this._request('', 'GET', true);
- this._xhr.onreadystatechange = function(){
- if (self._xhr.readyState == 4) self._onData(self._xhr.responseText);
- };
- this._xhr.send(null);
- };
-
- XHRMultipart.check = function(){
- return 'XMLHttpRequest' in window && 'prototype' in XMLHttpRequest && 'multipart' in XMLHttpRequest.prototype;
- };
- XHRMultipart.xdomainCheck = function(){
- return true;
- };
-
- })();