vm/moonshine.js
function (url, success, error) {
			var xhr = new XMLHttpRequest(),
				parse;

			xhr.open('GET', url, true);


			// Use ArrayBuffer where possible. Luac files do not load properly with 'text'.
			if ('ArrayBuffer' in window) {
				xhr.responseType = 'arraybuffer';

				parse = function (data) {
					// There is a limit on the number of arguments one can pass to a function. So far iPad is the lowest, and 10000 is safe.
					// If safe number of arguments to pass to fromCharCode:
					if (data.byteLength <= 10000) return String.fromCharCode.apply(String, Array.prototype.slice.call(new Uint8Array(data)));

					// otherwise break up bytearray:
					var i, l,
						arr = new Uint8Array(data),
						result = '';

					for (i = 0, l = data.byteLength; i < l; i += 10000) {
						result += String.fromCharCode.apply(String, Array.prototype.slice.call(arr.subarray(i, Math.min(i + 10000, l))));
					}

					return result;
				};

			} else {
				xhr.responseType = 'text';
				parse = function (data) { return data; };
			}


			xhr.onload = function (e) {
				if (this.status == 200) {
					if (success) success(parse(this.response));
				} else {
					if (error) error(this.status);
				}
			}

			xhr.send(shine.EMPTY_OBJ);
	    }
function (url, success, error) {
			var xhr = new XMLHttpRequest(),
				parse;

			xhr.open('GET', url, true);


			// Use ArrayBuffer where possible. Luac files do not load properly with 'text'.
			if ('ArrayBuffer' in window) {
				xhr.responseType = 'arraybuffer';

				parse = function (data) {
					// There is a limit on the number of arguments one can pass to a function. So far iPad is the lowest, and 10000 is safe.
					// If safe number of arguments to pass to fromCharCode:
					if (data.byteLength <= 10000) return String.fromCharCode.apply(String, Array.prototype.slice.call(new Uint8Array(data)));

					// otherwise break up bytearray:
					var i, l,
						arr = new Uint8Array(data),
						result = '';

					for (i = 0, l = data.byteLength; i < l; i += 10000) {
						result += String.fromCharCode.apply(String, Array.prototype.slice.call(arr.subarray(i, Math.min(i + 10000, l))));
					}

					return result;
				};

			} else {
				xhr.responseType = 'text';
				parse = function (data) { return data; };
			}


			xhr.onload = function (e) {
				if (this.status == 200) {
					if (success) success(parse(this.response));
				} else {
					if (error) error(this.status);
				}
			}

			xhr.send(shine.EMPTY_OBJ);
	    }
function ( url , success , error ) { var xhr = new XMLHttpRequest ( ) , parse ; xhr . open ( 'GET' , url , true ) ; // Use ArrayBuffer where possible. Luac files do not load properly with 'text'. if ( 'ArrayBuffer' in window ) { xhr . responseType = 'arraybuffer' ; parse = function ( data ) { // There is a limit on the number of arguments one can pass to a function. So far iPad is the lowest, and 10000 is safe. // If safe number of arguments to pass to fromCharCode: if ( data . byteLength <= 10000 ) return String . fromCharCode . apply ( String , Array . prototype . slice . call ( new Uint8Array ( data ) ) ) ; // otherwise break up bytearray: var i , l , arr = new Uint8Array ( data ) , result = '' ; for ( i = 0 , l = data . byteLength ; i < l ; i += 10000 ) { result += String . fromCharCode . apply ( String , Array . prototype . slice . call ( arr . subarray ( i , Math . min ( i + 10000 , l ) ) ) ) ; } return result ; } ; } else { xhr . responseType = 'text' ; parse = function ( data ) { return data ; } ; } xhr . onload = function ( e ) { if ( this . status == 200 ) { if ( success ) success ( parse ( this . response ) ) ; } else { if ( error ) error ( this . status ) ; } } xhr . send ( shine . EMPTY_OBJ ) ; }
Makes an HTTP GET request.
@param {String} url The URL to request.
@param {Function} success The callback to be executed upon a successful outcome.
@param {Function} error The callback to be executed upon an unsuccessful outcome.
Makes an HTTP GET request .