Event Binding (ActionSet for Events)

Wiring events on elements works same as expected in regular html even within the context of Atoms.js. However to execute an ActionSet (Explained in next session), on particular event, we have special way of defining action sets on event.

Please note, action sets will be invoked in context of current of closest parent atom control. And if you have set function as action set then this function will receive parameters differently.

Function as ActionSet

When you are setting JavaScript function as action set, as usual function receives scope and sender as arguments and it receives third argument as "event" which is a jQuery event object for the particular event.

 

In above example,

  1. Button click Event displays an alert, please note the syntax is of Action Set defined in ActionSets section. Actionsets are bindable and are pure JavaScript anonymous objects.
  2. Mouse enter and mouse out events of div toggles color variable in scope which causes background to change.