Class: Dommy::KeyboardEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/dommy/event.rb

Constant Summary

Constants inherited from Event

Event::AT_TARGET, Event::BUBBLING_PHASE, Event::CAPTURING_PHASE, Event::NONE

Instance Attribute Summary

Attributes inherited from Event

#type

Instance Method Summary collapse

Methods inherited from Event

#__internal_clear_propagation_flags__, #__internal_mark_trusted__, #__internal_prepare_for_dispatch__, #__internal_record_path__, #__internal_set_current_target__, #__internal_set_dispatch_flag__, #__internal_set_event_phase__, #__js_call__, #__js_set__, #bubbles?, #default_prevented?, #immediate_propagation_stopped?, #init_event, #propagation_stopped?

Methods included from Bridge::Methods

included

Constructor Details

#initialize(type, init = nil) ⇒ KeyboardEvent

Returns a new instance of KeyboardEvent.



590
591
592
593
594
595
596
597
# File 'lib/dommy/event.rb', line 590

def initialize(type, init = nil)
  super
  @key = read_init(init, "key").to_s
  @ctrl_key = !!read_init(init, "ctrlKey")
  @shift_key = !!read_init(init, "shiftKey")
  @alt_key = !!read_init(init, "altKey")
  @meta_key = !!read_init(init, "metaKey")
end

Instance Method Details

#__js_get__(key) ⇒ Object



599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
# File 'lib/dommy/event.rb', line 599

def __js_get__(key)
  case key
  when "key"
    @key
  when "ctrlKey"
    @ctrl_key
  when "shiftKey"
    @shift_key
  when "altKey"
    @alt_key
  when "metaKey"
    @meta_key
  else
    super
  end
end