Event Handling

Attaching event listeners

You can attach event listeners with the colorpicker.events.on() method:

colorpicker.events.on("ModeChange", function(mode) {
   console.log("Selected mode: " + mode); 
});

The names of events are case-insensitive.

Related sample:  Colorpicker. Events

Detaching event listeners

To detach events, use colorpicker.events.detach():

colorpicker.events.on("ModeChange", function(mode) {
   console.log("Selected mode: " + mode); 
});
 
colorpicker.events.detach("ModeChange");

Calling events

To call events, use colorpicker.events.fire():

colorpicker.events.fire("name",args);
// where args is an array of arguments

The list of events

The full list of events is available in the related API section.

Back to top