Class: React::SyntheticEvent

Inherits:
Object
  • Object
show all
Includes:
Native::Wrapper
Defined in:
lib/react/synthetic_event.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.native_accessors(*js_names) ⇒ Object

helpers



5
6
7
8
9
10
11
12
# File 'lib/react/synthetic_event.rb', line 5

def self.native_accessors(*js_names)
  js_names.each do |js_name|
    ruby_name = js_name.underscore
    define_method(ruby_name) do
      @native.JS[js_name]
    end
  end
end

.native_boolean_accessors(*js_names) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/react/synthetic_event.rb', line 14

def self.native_boolean_accessors(*js_names)
  js_names.each do |js_name|
    ruby_name = js_name.underscore + '?'
    define_method(ruby_name) do
      @native.JS[js_name]
    end
  end
end

Instance Method Details

#current_targetObject



37
38
39
# File 'lib/react/synthetic_event.rb', line 37

def current_target
  Browser::Element.new(@native.JS[:currentTarget])
end

#native_eventObject



41
42
43
# File 'lib/react/synthetic_event.rb', line 41

def native_event
  Browser::Event.new(@native.JS[:nativeEvent])
end


45
46
47
# File 'lib/react/synthetic_event.rb', line 45

def related_target
  Browser::Element.new(@native.JS[:relatedTarget])
end

#targetObject



49
50
51
# File 'lib/react/synthetic_event.rb', line 49

def target
  Browser::Element.new(@native.JS[:target])
end