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::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) ⇒ InputEvent

Returns a new instance of InputEvent.



470
471
472
473
474
475
# File 'lib/dommy/event.rb', line 470

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



477
478
479
480
481
482
483
484
485
486
487
488
# File 'lib/dommy/event.rb', line 477

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