src/loader/loader.js
function preloadJSON(data, onload, onerror) {
            var xmlhttp = new XMLHttpRequest();

            if (xmlhttp.overrideMimeType) {
                xmlhttp.overrideMimeType("application/json");
            }

            xmlhttp.open("GET", data.src + api.nocache, true);
            xmlhttp.withCredentials = me.loader.withCredentials;

            // set the callbacks
            xmlhttp.ontimeout = onerror;
            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.readyState === 4) {
                    // status = 0 when file protocol is used, or cross-domain origin,
                    // (With Chrome use "--allow-file-access-from-files --disable-web-security")
                    if ((xmlhttp.status === 200) || ((xmlhttp.status === 0) && xmlhttp.responseText)) {
                        // get the Texture Packer Atlas content
                        jsonList[data.name] = JSON.parse(xmlhttp.responseText);
                        // fire the callback
                        onload();
                    }
                    else {
                        onerror(data.name);
                    }
                }
            };
            // send the request
            xmlhttp.send();
        }
function preloadJSON(data, onload, onerror) {
            var xmlhttp = new XMLHttpRequest();

            if (xmlhttp.overrideMimeType) {
                xmlhttp.overrideMimeType("application/json");
            }

            xmlhttp.open("GET", data.src + api.nocache, true);
            xmlhttp.withCredentials = me.loader.withCredentials;

            // set the callbacks
            xmlhttp.ontimeout = onerror;
            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.readyState === 4) {
                    // status = 0 when file protocol is used, or cross-domain origin,
                    // (With Chrome use "--allow-file-access-from-files --disable-web-security")
                    if ((xmlhttp.status === 200) || ((xmlhttp.status === 0) && xmlhttp.responseText)) {
                        // get the Texture Packer Atlas content
                        jsonList[data.name] = JSON.parse(xmlhttp.responseText);
                        // fire the callback
                        onload();
                    }
                    else {
                        onerror(data.name);
                    }
                }
            };
            // send the request
            xmlhttp.send();
        }
function preloadJSON ( data , onload , onerror ) { var xmlhttp = new XMLHttpRequest ( ) ; if ( xmlhttp . overrideMimeType ) { xmlhttp . overrideMimeType ( "application/json" ) ; } xmlhttp . open ( "GET" , data . src + api . nocache , true ) ; xmlhttp . withCredentials = me . loader . withCredentials ; // set the callbacks xmlhttp . ontimeout = onerror ; xmlhttp . onreadystatechange = function ( ) { if ( xmlhttp . readyState === 4 ) { // status = 0 when file protocol is used, or cross-domain origin, // (With Chrome use "--allow-file-access-from-files --disable-web-security") if ( ( xmlhttp . status === 200 ) || ( ( xmlhttp . status === 0 ) && xmlhttp . responseText ) ) { // get the Texture Packer Atlas content jsonList [ data . name ] = JSON . parse ( xmlhttp . responseText ) ; // fire the callback onload ( ) ; } else { onerror ( data . name ) ; } } } ; // send the request xmlhttp . send ( ) ; }
preload JSON files
@ignore
preload JSON files