nl_tokens: Sends a HTTP request to the server and returns a Promise with an additional . abort () method to cancel the request . This method is the standard way of doing xhr - requests without processing streams .
pl_tokens: function ( options ) { var instance = this , props = { } , xhr , promise ; options = Object . itsa_isObject ( options ) ? options . itsa_deepClone ( ) : { } ; promise = Promise . itsa_manage ( options . streamback , options . stayActive ) ; xhr = new XMLHttpRequest ( ) ; props . _isXHR2 = xhr2support ; // it could be other modules like io-cors or io-stream have subscribed // xhr might be changed, also private properties might be extended <mask> . _xhrList . forEach ( function ( fn ) { xhr = fn ( xhr , props , options , promise ) ; } ) ; if ( ! xhr ) { return Promise . reject ( NO_XHR ) ; } xhr . itsa_merge ( props ) ; // Don"t use xhr.timeout --> IE<10 throws an error when set xhr.timeout // We use a timer that aborts the request Object . defineProperty ( xhr , "_timer" , { configurable : false , enumerable : false , writable : false , value : setTimeout ( function ( ) { promise . reject ( REQUEST_TIMEOUT ) ; xhr . _aborted = true ; // must be set: IE9 won"t allow to read anything on xhr after being aborted xhr . abort ( ) ; } , options . timeout || instance . config . timeout || DEF_REQ_TIMEOUT ) } ) ; instance . _initXHR ( xhr , options , promise ) ; // add to interbal hash: instance . _runningRequests . push ( promise ) ; // remove it when ready: promise . itsa_finally ( function ( ) { instance . _runningRequests . itsa_remove ( promise ) ; } ) ; return promise ; }