class Preact::Component::Props

Public Class Methods

new(native) click to toggle source
# File lib/preact/component/props.rb, line 4
def initialize(native)
  @native = native
end

Public Instance Methods

children() click to toggle source
# File lib/preact/component/props.rb, line 19
def children
  @native.JS[:props].JS[:children]
end
isomorfeus_store() click to toggle source
# File lib/preact/component/props.rb, line 23
def isomorfeus_store
  # TODO
  @native.JS[:props].JS[:isomorfeus_store]
end
method_missing(prop, *args, &block) click to toggle source
# File lib/preact/component/props.rb, line 8
def method_missing(prop, *args, &block)
  %x{
    const p = #@native.props;
    if (typeof p[prop] === 'undefined') {
      prop = Opal.Preact.lower_camelize(prop);
      if (typeof p[prop] === 'undefined') { return nil; }
    }
    return p[prop];
  }
end
params() click to toggle source
# File lib/preact/component/props.rb, line 32
def params
  return @params if @params
  return nil if `typeof #@native.props.params === 'undefined'`
  @params = ::Preact::Component::Params.new(`#@native.props.params`)
end
theme() click to toggle source
# File lib/preact/component/props.rb, line 28
def theme
  `#@native.props.iso_theme`
end
to_h() click to toggle source
# File lib/preact/component/props.rb, line 38
def to_h
  `Opal.Hash.$new(#@native.props)`.transform_keys!(&:underscore)
end
to_json() click to toggle source
# File lib/preact/component/props.rb, line 42
def to_json
  JSON.dump(to_transport)
end
to_n() click to toggle source
# File lib/preact/component/props.rb, line 46
def to_n
  @native.JS[:props]
end
to_transport() click to toggle source
# File lib/preact/component/props.rb, line 50
def to_transport
  {}.merge(to_h)
end