Class: Dommy::KeyboardEvent

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

Constant Summary

Constants inherited from Event

Event::JS_METHOD_NAMES

Instance Attribute Summary

Attributes inherited from Event

#type

Instance Method Summary collapse

Methods inherited from Event

#__internal_prepare_for_dispatch__, #__internal_record_path__, #__internal_set_current_target__, #__js_call__, #__js_method_names__, #__js_set__, #bubbles?, #default_prevented?, #immediate_propagation_stopped?, #init_event, #propagation_stopped?

Constructor Details

#initialize(type, init = nil) ⇒ KeyboardEvent

Returns a new instance of KeyboardEvent.



439
440
441
442
443
444
445
446
# File 'lib/dommy/event.rb', line 439

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



448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
# File 'lib/dommy/event.rb', line 448

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