Closed StephenErstad-zz closed 9 years ago
Hi,
Currently, there is no way to achieve this however I think it is a good idea so I will add a flush method on the batcher that will flush all pending batches, I think as well if you pass an endpoint url into this function it will just flush that batch. I'll try and do it tonight and let you know.
Jon
Hi,
I've added the flush method as described - there is a little bit of documentation in the Readme.md file.
Let me know if this is what you wanted and if it works in a prod system. I've added some unit tests and works locally.
In some instances you might want to immediately send all pending request regardless of if the request quota or timeout limit has been reached. To do this you can simply call the flush method on the httpBatcher service and optionally pass in the url of the batch endpoint you want to flush (if no parameter is passed in all pending requests to all endpoints are flushed).
angular.module('myApp', ['jcs.angular-http-batch']);
.run([
'httpBatcher',
function (httpBatcher) {
httpBatcher.flush();
}
]);
Awesome! Thank you!
How does the module handle or support the need to spontaneously send the batch?
For example, on unload we would like to send the most recent batch regardless of quota or time being hit.