Sha256: 5c5ebd300d706aafe73748dc195a53d3ebf0843af5df5eb94139c37f0697da7d

Contents?: true

Size: 476 Bytes

Versions: 13

Compression:

Stored size: 476 Bytes

Contents

module React
  module FunctionComponent
    module EventHandler
      def event_handler(name, &block)
        define_method(name) do |event, info|
          ruby_event = if `typeof event === "object"`
                         ::React::SyntheticEvent.new(event)
                       else
                         event
                       end
          block.call(ruby_event, info)
        end
        `self[name] = self.prototype['$' + name]`
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
isomorfeus-react-16.11.0 lib/react/function_component/event_handler.rb
isomorfeus-react-16.10.17 lib/react/function_component/event_handler.rb
isomorfeus-react-16.10.16 lib/react/function_component/event_handler.rb
isomorfeus-react-16.10.14 lib/react/function_component/event_handler.rb
isomorfeus-react-16.10.13 lib/react/function_component/event_handler.rb
isomorfeus-react-16.10.12 lib/react/function_component/event_handler.rb
isomorfeus-react-16.10.11 lib/react/function_component/event_handler.rb
isomorfeus-react-16.10.10 lib/react/function_component/event_handler.rb
isomorfeus-react-16.10.9 lib/react/function_component/event_handler.rb
isomorfeus-react-16.10.8 lib/react/function_component/event_handler.rb
isomorfeus-react-16.10.7 lib/react/function_component/event_handler.rb
isomorfeus-react-16.10.6 lib/react/function_component/event_handler.rb
isomorfeus-react-16.10.5 lib/react/function_component/event_handler.rb