Defines the logic that is invoked after all operations have been finished.

import Batch = require("nativescript-batch");

var b = Batch.newBatch(function(ctx) {
    console.log("Operation 1");
    ctx.checkIfFinished();  // nohting happens here
}).then(function(ctx) {
    console.log("Operation 2");
    ctx.checkIfFinished();  // nohting happens here
}).then(function(ctx) {
    console.log("Operation 3");
    ctx.checkIfFinished();  // invokes "whenAllFinished" action
}).whenAllFinished(function(ctx) {
    console.log("All operations finished.");
});

b.start();