processors
can.Control.processors
{Object<can.Control.processor(element, eventName, selector, handler, control)>}
A collection of hookups for custom events on Controls.
processorsis an object that allows you to add new events to bind to on a control, or to change how existent events are bound. Each key-value pair ofprocessorsis a specification that pertains to an event where the key is the name of the event, and the value is a function that processes calls to bind to the event.The processor function takes five arguments:
Inside your processor function, you should bind callback to the event, and return a function for can.Control to call when callback needs to be unbound. (If selector is defined, you will likely want to use some form of delegation to bind the event.)
Here is a Control with a custom event processor set and two callbacks bound to that event:
When
targetis initialized, can.Control will callcan.Control.processors.birthdaytwice (because there are two event hookups for the birthday event). The first time it's called, the arguments will be:'birthday'''' birthday'in the prototype section ofEventTarget's definition.targetitself.The second time, the arguments are slightly different:
'birthday''.grandchild''.grandchild birthday'in the prototype section ofEventTarget's definition.targetitself.can.Control already has processors for these events: