argon/storage/json_rest.js
function (xhr, message, callback) {
        var response;

        switch (xhr.status) {
            case this.RESPONSE_OK:
                response = JSON.parse(xhr.responseText);
                break;
            case this.RESPONSE_UNPROCESSABLE_ENTITY:
                response = JSON.parse(xhr.responseText);
                break;
            case this.RESPONSE_NOT_FOUND:
                response = {
                  error : xhr.status
                };
                break;
            case this.RESPONSE_INTERNAL_SERVER_ERROR:
                response = {};
                break;
            case this.RESPONSE_SERVER_UNAVALIABLE:
                console.log('Server is unavailable, probably shutdown.');
                response = {};
                break;
            default:
                console.log('Unsuported code returned from the server: ', xhr.status);
                response = {
                    error : xhr.status
                };
        }

        callback(response);

        return this;
    }
function (xhr, message, callback) {
        var response;

        switch (xhr.status) {
            case this.RESPONSE_OK:
                response = JSON.parse(xhr.responseText);
                break;
            case this.RESPONSE_UNPROCESSABLE_ENTITY:
                response = JSON.parse(xhr.responseText);
                break;
            case this.RESPONSE_NOT_FOUND:
                response = {
                  error : xhr.status
                };
                break;
            case this.RESPONSE_INTERNAL_SERVER_ERROR:
                response = {};
                break;
            case this.RESPONSE_SERVER_UNAVALIABLE:
                console.log('Server is unavailable, probably shutdown.');
                response = {};
                break;
            default:
                console.log('Unsuported code returned from the server: ', xhr.status);
                response = {
                    error : xhr.status
                };
        }

        callback(response);

        return this;
    }
function ( xhr , message , callback ) { var response ; switch ( xhr . status ) { case this . RESPONSE_OK : response = JSON . parse ( xhr . responseText ) ; break ; case this . RESPONSE_UNPROCESSABLE_ENTITY : response = JSON . parse ( xhr . responseText ) ; break ; case this . RESPONSE_NOT_FOUND : response = { error : xhr . status } ; break ; case this . RESPONSE_INTERNAL_SERVER_ERROR : response = { } ; break ; case this . RESPONSE_SERVER_UNAVALIABLE : console . log ( 'Server is unavailable, probably shutdown.' ) ; response = { } ; break ; default : console . log ( 'Unsuported code returned from the server: ' , xhr . status ) ; response = { error : xhr . status } ; } callback ( response ) ; return this ; }
Internal data processing for request responses
In order to transform the responses from the server to native models this process does certain operations
to transform the data from the server notation to JavaScript notation
@method _processResponse <public, static> [Function]
@argument xhr
@argument message
@argument callback
Internal data processing for request responses In order to transform the responses from the server to native models this process does certain operations to transform the data from the server notation to JavaScript notation