nakarte

Source code of https://map.sikmir.ru (fork)
git clone git://git.sikmir.ru/nakarte
Log | Files | Refs | LICENSE

commit 6abd1a0478a1d3a17412dd2c5af50ab3897f1048
parent 68973e983dc4ecf36d18d1d716e0cd48ded245ea
Author: Sergej Orlov <wladimirych@gmail.com>
Date:   Fri, 27 Jan 2017 01:37:58 +0300

fixes in XHRQueue

Diffstat:
Msrc/lib/xhr-promise/index.js | 10+++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/lib/xhr-promise/index.js b/src/lib/xhr-promise/index.js @@ -105,8 +105,10 @@ class XHRQueue { put(url, options) { const promise = new XMLHttpRequestPromise(url, options); promise._originalAbort = promise.abort; - promise.abort = this._abortPromise.bind(promise) + promise.abort = () => this._abortPromise(promise); this._queue.push(promise); + this._processQueue(); + return promise; } _abortPromise(promise) { @@ -125,7 +127,9 @@ class XHRQueue { return; } const promise = this._queue.shift(); - promise.then(() => this._onRequestReady(promise)); + promise + .catch(() => {}) + .then(() => this._onRequestReady(promise)); this._activeCount += 1; promise.send() } @@ -147,5 +151,5 @@ function fetch(url, options) { } -export {fetch}; +export {fetch, XHRQueue};