Class: Dommy::InputEvent

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

Overview

InputEvent — fired by input / beforeinput. Carries data (the inserted text, if any) and inputType (insertText, deleteContentBackward, etc.).

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_run_passive__, #__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) ⇒ InputEvent

Returns a new instance of InputEvent.



1029
1030
1031
1032
1033
1034
# File 'lib/dommy/event.rb', line 1029

def initialize(type, init = nil)
  super
  @data = read_init(init, "data")
  @input_type = (read_init(init, "inputType") || "").to_s
  @is_composing = !!read_init(init, "isComposing")
end

Instance Method Details

#__js_get__(key) ⇒ Object



1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
# File 'lib/dommy/event.rb', line 1036

def __js_get__(key)
  case key
  when "data"
    @data
  when "inputType"
    @input_type
  when "isComposing"
    @is_composing
  else
    super
  end
end