can.bind
Listen for events on an object.
can.bind.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.bind(eventName, handler)binds a callback handler on an object for a given event. It works on:The idea is that
can.bindcan be used on anything that produces events and it will figure out the appropriate way to bind to it. Typically,can.bindis only used internally to CanJS; however, if you are making libraries or extensions, usecan.bindto listen to events independent of the underlying library.Binding to an object
Binding to an HTMLElement