Class: Event
- Inherits:
-
Object
- Object
- Event
- Defined in:
- opal/opal-jquery/event.rb
Overview
Wraps native jQuery event objects.
Instance Method Summary (collapse)
- - (Object) [](name)
- - (Object) ctrl_key
-
- (Object) current_target
Element.
-
- (Event) initialize(native)
constructor
A new instance of Event.
- - (Object) key_code
-
- (Object) kill
Stops propagation and prevents default action.
-
- (Object) page_x
Keyboard/Mouse/Touch.
- - (Object) page_y
- - (Object) prevent (also: #prevent_default)
-
- (Boolean) prevented?
(also: #default_prevented?)
Propagation.
- - (Object) stop (also: #stop_propagation)
- - (Object) stop_immediate (also: #stop_immediate_propagation)
- - (Boolean) stopped? (also: #propagation_stopped?)
- - (Object) target
- - (Object) touch_x
- - (Object) touch_y
- - (Object) type
- - (Object) which
Constructor Details
- (Event) initialize(native)
Returns a new instance of Event
7 8 9 |
# File 'opal/opal-jquery/event.rb', line 7 def initialize(native) @native = native end |
Instance Method Details
- (Object) [](name)
11 12 13 |
# File 'opal/opal-jquery/event.rb', line 11 def [](name) `#@native[name]` end |
- (Object) ctrl_key
85 86 87 |
# File 'opal/opal-jquery/event.rb', line 85 def ctrl_key `#@native.ctrlKey` end |
- (Object) current_target
Element
22 23 24 |
# File 'opal/opal-jquery/event.rb', line 22 def current_target `$(#@native.currentTarget)` end |
- (Object) key_code
89 90 91 |
# File 'opal/opal-jquery/event.rb', line 89 def key_code `#@native.keyCode` end |
- (Object) kill
Stops propagation and prevents default action.
54 55 56 57 |
# File 'opal/opal-jquery/event.rb', line 54 def kill stop prevent end |
- (Object) page_x
Keyboard/Mouse/Touch
69 70 71 |
# File 'opal/opal-jquery/event.rb', line 69 def page_x `#@native.pageX` end |
- (Object) page_y
73 74 75 |
# File 'opal/opal-jquery/event.rb', line 73 def page_y `#@native.pageY` end |
- (Object) prevent Also known as: prevent_default
37 38 39 |
# File 'opal/opal-jquery/event.rb', line 37 def prevent `#@native.preventDefault()` end |
- (Boolean) prevented? Also known as: default_prevented?
Propagation
33 34 35 |
# File 'opal/opal-jquery/event.rb', line 33 def prevented? `#@native.isDefaultPrevented()` end |
- (Object) stop Also known as: stop_propagation
45 46 47 |
# File 'opal/opal-jquery/event.rb', line 45 def stop `#@native.stopPropagation()` end |
- (Object) stop_immediate Also known as: stop_immediate_propagation
49 50 51 |
# File 'opal/opal-jquery/event.rb', line 49 def stop_immediate `#@native.stopImmediatePropagation()` end |
- (Boolean) stopped? Also known as: propagation_stopped?
41 42 43 |
# File 'opal/opal-jquery/event.rb', line 41 def stopped? `#@native.isPropagationStopped()` end |
- (Object) target
26 27 28 |
# File 'opal/opal-jquery/event.rb', line 26 def target `$(#@native.target)` end |
- (Object) touch_x
77 78 79 |
# File 'opal/opal-jquery/event.rb', line 77 def touch_x `#@native.originalEvent.touches[0].pageX` end |
- (Object) touch_y
81 82 83 |
# File 'opal/opal-jquery/event.rb', line 81 def touch_y `#@native.originalEvent.touches[0].pageY` end |
- (Object) type
15 16 17 |
# File 'opal/opal-jquery/event.rb', line 15 def type `#@native.type` end |
- (Object) which
93 94 95 |
# File 'opal/opal-jquery/event.rb', line 93 def which `#@native.which` end |