-
Notifications
You must be signed in to change notification settings - Fork 30
Event Handlers
catmando edited this page Oct 28, 2015
·
2 revisions
In React.js event handlers are provided as functions attached to component attributes:
<p onClick={function(evt) {alert ("that's what!") }>
click me to see what happens.
</p>
In ruby we send the .on method to the component with an event type and block like this:
p { "click me to see what happens." }.
on(:click) { |evt| alert "that's what!" }
There is no special semantics created, its just syntactic sugar.
These events are supported:
copy
cut
paste
key_down
key_press
key_up
focus
blur
change
input
submit
click
double_click
drag
drag_end
drag_enter
drag_exit
drag_leave
drag_over
drag_start
drop
mouse_down
mouse_enter
mouse_leave
mouse_move
mouse_out
mouse_over
mouse_up
touch_cancel
touch_end
touch_move
touch_start
scroll
TBD: List the methods that can be applied to events, i.e. event.target.value etc.