Class: Volt::JSEvent
Overview
TODO: We need to figure out how we want to wrap JS events
Instance Attribute Summary collapse
-
#js_event ⇒ Object
readonly
Returns the value of attribute js_event.
Instance Method Summary collapse
-
#initialize(js_event) ⇒ JSEvent
constructor
A new instance of JSEvent.
- #key_code ⇒ Object
- #prevent_default! ⇒ Object
- #stop! ⇒ Object
- #target ⇒ Object
Constructor Details
#initialize(js_event) ⇒ JSEvent
Returns a new instance of JSEvent.
8 9 10 |
# File 'lib/volt/page/bindings/event_binding.rb', line 8 def initialize(js_event) @js_event = js_event end |
Instance Attribute Details
#js_event ⇒ Object (readonly)
Returns the value of attribute js_event.
6 7 8 |
# File 'lib/volt/page/bindings/event_binding.rb', line 6 def js_event @js_event end |
Instance Method Details
#key_code ⇒ Object
12 13 14 |
# File 'lib/volt/page/bindings/event_binding.rb', line 12 def key_code `this.js_event.keyCode` end |
#prevent_default! ⇒ Object
20 21 22 |
# File 'lib/volt/page/bindings/event_binding.rb', line 20 def prevent_default! `this.js_event.preventDefault();` end |
#stop! ⇒ Object
16 17 18 |
# File 'lib/volt/page/bindings/event_binding.rb', line 16 def stop! `this.js_event.stopPropagation();` end |
#target ⇒ Object
24 25 26 |
# File 'lib/volt/page/bindings/event_binding.rb', line 24 def target `this.js_event.toElement` end |