@spalger/kibana
Version:
Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic
28 lines (22 loc) • 827 B
JavaScript
define(function (require) {
return function CourierFetchContinueIncompleteRequests(Private) {
var INCOMPLETE = Private(require('ui/courier/fetch/_req_status')).INCOMPLETE;
function continueIncompleteRequests(strategy, requests, responses, fetchWithStrategy) {
var incomplete = [];
responses.forEach(function (resp, i) {
if (resp === INCOMPLETE) {
incomplete.push(requests[i]);
}
});
if (!incomplete.length) return responses;
return fetchWithStrategy(strategy, incomplete)
.then(function (completedResponses) {
return responses.map(function (prevResponse) {
if (prevResponse !== INCOMPLETE) return prevResponse;
return completedResponses.shift();
});
});
}
return continueIncompleteRequests;
};
});