dispatch
Dispatchs an event within the event batching system.
canBatch.trigger(item, event [, args])
Makes sure an event is fired at the appropriate time within the appropriate batch. How and when the event fires depends on the batching state.
There are three states of batching:
- no queues -
trigger
is called outside of anystart
orstop
call -> The event is dispatched immediately. - collecting batch -
trigger
is called between astart
orstop
call -> The event is dispatched whenstop
is called. - firing queues -
trigger
is called due to anothertrigger
called within a batch -> The event is dispatched after the current batch has completed in a new batch.
Finally, if the event has a batchNum
it is fired immediately.
Parameters
- item
{Object}
:the target of the event.
- event
{String|Object}
:the type of event, or an event object with a type given like
{type: 'name'}
- args
{Array}
:the parameters to trigger the event with.