Sha256: efe188b6ea59d22da5f61eadc8c3bd34e7262a07ea662c7a0653b49f050771ab
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 KB
Contents
# Wraps native jQuery event objects. class Event def initialize(native) @native = native end def [](name) `#@native[name]` end def type `#@native.type` end ## # Element def current_target `$(#@native.currentTarget)` end def target `$(#@native.target)` end ## # Propagation def default_prevented? `#@native.isDefaultPrevented()` end def prevent_default `#@native.preventDefault()` end def propagation_stopped? `#@native.propagationStopped()` end def stop_propagation `#@native.stopPropagation()` end def stop_immediate_propagation `#@native.stopImmediatePropagation()` end # Stops propagation and prevents default action. def kill stop_propagation prevent_default end ## # Keyboard/Mouse/Touch def page_x `#@native.pageX` end def page_y `#@native.pageY` end def touch_x `#@native.originalEvent.touches[0].pageX` end def touch_y `#@native.originalEvent.touches[0].pageY` end def ctrl_key `#@native.ctrlKey` end def key_code `#@native.keyCode` end def which `#@native.which` end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
opal-jquery-0.1.2 | opal/opal-jquery/event.rb |
opal-jquery-0.1.1 | opal/opal-jquery/event.rb |
opal-jquery-0.1.0 | opal/opal-jquery/event.rb |