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
      • static
        • addEventListener
        • bind
        • delegate
        • dispatch
        • listenTo
        • off
        • on
        • one
        • removeEventListener
        • stopListening
        • trigger
        • unbind
        • undelegate
    • can-event/async/async
    • can-event/batch/batch
    • 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
  • /
  • addEventListener
  • / On this page
    • addEventListener

      function
      • source

      obj.addEventListener(event, handler)

      Add a basic event listener to an object.

      var canEvent = require("can-event");
      
      var obj = {};
      Object.assign(obj, canEvent);
      
      obj.addEventListener("foo", function(){ ... });
      

      Parameters

      1. event {String}:

        The name of the event to listen for.

      2. handler {function}:

        The handler that will be executed to handle the event.

      Returns

      {Object}:

      this

      canEvent.addEventListener.call(obj, event, handler)

      This syntax can be used for objects that don't include the canEvent mixin.

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