Sha256: 4c088b10ba9c9c418d3057e9c1bada70ad3fa11847e51a81ed49992c61465572
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
module LucidComponent class AppStoreProxy def initialize(component_instance) if component_instance @native = component_instance.to_n @component_instance = component_instance end end def [](key) method_missing(key) end def []=(key, value) method_missing(key, value) end def method_missing(key, *args, &block) if `args.length > 0` # set class state, simply a dispatch action = { type: 'APPLICATION_STATE', name: (`key.endsWith('=')` ? key.chop : key), value: args[0] } Isomorfeus.store.collect_and_defer_dispatch(action) else # check if we have a component local state value if @native && `#@native.props.store` if `#@native.props.store.application_state && #@native.props.store.application_state.hasOwnProperty(key)` return @native.JS[:props].JS[:store].JS[:application_state].JS[key] end else return AppStore[key] end # otherwise return nil return nil end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
isomorfeus-react-16.13.12 | lib/isomorfeus_react/lucid_component/app_store_proxy.rb |