start

canBatch.start([batchStopHandler])

Parameters

batchStopHandler{function}:

a callback that gets called after all batched events have been called.

canBatch.start begins an event batch. Until stop is called, any
events that would result from calls to [can-event/batch/batch.trigger] to are held back from firing. If you have
lots of changes to make to observables, batching them together can help performance - especially if
those observables are live-bound to the DOM.

In this example, you can see how the first event is not fired (and their handlers
are not called) until canBatch.stop is called.

You can also pass a callback to canBatch.start which will be called after all the events have
been fired:

canBatch.start(function() {
console.log('The batch is over.');
});
person.first = "Izzy"
console.log('Still in the batch.');
canBatch.stop();
// The console has:
// Still in the batch.
// First name changed.
// The batch is over.

Calling canBatch.start multiple times

If you call canBatch.start more than once, canBatch.stop needs to be called
the same number of times before any batched events will fire. For ways
to circumvent this process, see stop.

Here is an example that demonstrates how events are affected by calling
canBatch.start multiple times.