start
Begin an event batch.
can.batch.start([batchStopHandler])
Parameters
-
batchStopHandler
{function()}Optionala callback that gets called after all batched events have been called
Begin an event batch.
{function()}Optionala callback that gets called after all batched events have been called
can.batch.startcauses can.Map to begin an event batch. Untilcan.batch.stopis called, any events that would result from calls toattrare held back from firing. If you have lots of changes to make to can.Maps, batching them together can help performance &emdash; especially if those can.Maps are live-bound to the DOM.In this example, you can see how the first and change events are not fired (and their handlers are not called) until
can.batch.stopis called.You can also pass a callback to
can.batch.startwhich will be called after all the events have been fired:Calling
can.batch.startmultiple timesIf you call
can.batch.startmore than once,can.batch.stopneeds to be called the same number of times before any batched events will fire. For ways to circumvent this process, see can.batch.stop.Here is an example that demonstrates how events are affected by calling
can.batch.startmultiple times.