can.on
Listen for events on an object.
can.on.call(target, eventName, handler)
Parameters
-
target
{Object}
The object that emits events.
-
eventName
{String}
The name of the event to listen for.
-
handler
{function()}
The function to execute when the event occurs.
Returns
{Object}
The target.
can.on(eventName, handler)
is an alias forcan.bind(eventName, handler)
and binds a callback handler on an object for a given event. It works on:The idea is that
can.on
can be used on anything that produces events and it will figure out the appropriate way to bind to it.Binding to an object
Binding to an HTMLElement