Sha256: 284cc241311192b7effeb2876b97e80da571b90c66e1e630486b2bcedf55bef1

Contents?: true

Size: 724 Bytes

Versions: 13

Compression:

Stored size: 724 Bytes

Contents

Element.instance_eval do
  def self.find(selector)
    selector = begin
      selector.dom_node
    rescue
      selector
    end if `#{selector}.$dom_node !== undefined`
    `$(#{selector})`
  end

  def self.[](selector)
    find(selector)
  end

  define_method :render do |container = nil, params = {}, &block|
    if `#{self.to_n}._reactrb_component_class === undefined`
      `#{self.to_n}._reactrb_component_class = #{Class.new(Hyperloop::Component)}`
    end
    klass = `#{self.to_n}._reactrb_component_class`
    klass.class_eval do
      render(container, params, &block)
    end

    React.render(React.create_element(`#{self.to_n}._reactrb_component_class`), self)
  end
end if Object.const_defined?('Element')

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
hyper-react-1.0.0.lap27 lib/react/ext/opal-jquery/element.rb
hyper-react-1.0.0.lap26 lib/react/ext/opal-jquery/element.rb
hyper-react-1.0.0.lap25 lib/react/ext/opal-jquery/element.rb
hyper-react-1.0.0.lap24 lib/react/ext/opal-jquery/element.rb
hyper-react-1.0.0.lap23 lib/react/ext/opal-jquery/element.rb
hyper-react-1.0.0.lap22 lib/react/ext/opal-jquery/element.rb
hyper-react-1.0.0.lap21 lib/react/ext/opal-jquery/element.rb
hyper-react-0.12.7 lib/react/ext/opal-jquery/element.rb
hyper-react-0.12.6 lib/react/ext/opal-jquery/element.rb
hyper-react-0.12.5 lib/react/ext/opal-jquery/element.rb
hyper-react-0.12.4 lib/react/ext/opal-jquery/element.rb
hyper-react-0.12.3 lib/react/ext/opal-jquery/element.rb
hyper-react-0.12.2 lib/react/ext/opal-jquery/element.rb