class AppStore
Public Class Methods
method_missing(key, *args, &block)
click to toggle source
# File lib/app_store.rb, line 3 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 store for value a_state = Isomorfeus.store.get_state if a_state.key?(:application_state) && a_state[:application_state].key?(key) return a_state[:application_state][key] end # otherwise return nil return nil end end
promise_get(key)
click to toggle source
# File lib/app_store.rb, line 26 def promise_get(key) Promise.new.resolve(get(key)) end
promise_set(key, value)
click to toggle source
# File lib/app_store.rb, line 30 def promise_set(key, value) Promise.new.resolve(set(key, value)) end
subscribe(&block)
click to toggle source
# File lib/app_store.rb, line 34 def subscribe(&block) Isomorfeus.store.subscribe(&block) end
unsubscribe(unsubscriber)
click to toggle source
# File lib/app_store.rb, line 38 def unsubscribe(unsubscriber) `unsubscriber()` end