DoneJS StealJS jQuery ++ FuncUnit DocumentJS
3.0.0
2.3.27

 

  • Github
  • Twitter
  • Chat
  • Forum
  • Guides
  • Core
  • Ecosystem
  • Infrastructure
    • can-construct
    • can-control
    • can-event
    • can-event/async/async
    • can-event/batch/batch
      • afterPreviousEvents
      • collecting
      • dispatch
      • dispatching
      • queue
      • start
      • stop
    • can-observation
    • can-simple-map
    • can-util
    • can-view-callbacks
    • can-view-live
    • can-view-model
    • can-view-nodelist
    • can-view-parser
    • can-view-scope
    • can-view-target
  • Legacy
  • Bitovi
    • Bitovi.com
    • Blog
    • Consulting
    • Training
    • Open Source
  • Chat
  • Forum
  • Star
  • Follow @canjs
  • CanJS
  • /
  • Infrastructure
  • /
  • can-event/batch/batch
  • /
  • dispatch
  • / On this page
    • dispatch

      function

      Dispatchs an event within the event batching system.

      • source

      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 any start or stop call -> The event is dispatched immediately.
      • collecting batch - trigger is called between a start or stop call -> The event is dispatched when stop is called.
      • firing queues - trigger is called due to another trigger 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

      1. item {Object}:

        the target of the event.

      2. event {String|Object}:

        the type of event, or an event object with a type given like {type: 'name'}

      3. args {Array}:

        the parameters to trigger the event with.

      CanJS is part of DoneJS. Created and maintained by the core DoneJS team and Bitovi. Currently 3.0.0.