can-control-modifier
*This plugin is experimental and not official or supported*
The can-control-modifier plugin, allows you to augment methods and event callbacks declaritivly. This is most commonly used in conjunction with the can-util-function plugin to debounce, throttle and defer method or event callbacks:
var can = ;; // augments can.Control; // augments can itself var MyControl = canControl;
...but can also be used in clever ways like the modifier/key plugin (packaged with this plugin) which allows you to easily bind keyboard events to your controls in a nice easy to read way:
var KeyboardControl = canControl;
API
After the method name, or event name, add :
+ the method name + ({value to pass to the method})
.
{} {}
The method name provided will be searched for in the following order:
- on the options object passed into the control on instatiation
- on the can framework object (which in many cases is augmented by the can-util-function plugin or other plugins)
- on the window or global object
So you can either pass the method in with the options, provide it in defaults, extend can itself, or have the method globally available.
Licensing
MIT - Please see the file called LICENSE.