Defines the global action that is invoked BEFORE each operation.

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

var b = Batch.newBatch(function(ctx) {
    console.log("Operation 1");
}).then(function(ctx) {
    console.log("Operation 2");
}).then(function(ctx) {
    console.log("Operation 3");
});

b.before(function(ctx) {
    console.log("[BEFORE] Operation " + (ctx.index + 1));
});

b.start();