== Examples ==
List all batches owned by the App.
let batches_defer = navigator.XHRBatch.getBatches();
batches_defer.then(batches e => { for (let i in e.batches) { let batch = e.batches[i];
console.log("Batch Name: " + batch.name);
console.log(" Description: " + batch.description);
});
Once the network is available, the system app start transmissions for all batches.
function onNetworkAvailable() {
let allBatches_defer = navigator.XHRBatch.getAllBatches();
allBatches_defer.then(batches e => { for (let i in e.batches) { let batch = e.batches[i];
if (batch.state == navigator.XHRBatch.WAITING) {
batch.start();
}
Once one or more batches of the App are completed, the App would remove them from the user agent.
function onBatchCompleted() {
let batches_defer = navigator.XHRBatch.getBatches();