isomorfeus-redux 4.0.20 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd996d49213dec418ce28f56c5c26b10aaed39210235403d2f93e2103f1cd099
4
- data.tar.gz: c45d9514d1def03ce507852cd8aa030619d2559faaa178ca689c70396e3c0d5f
3
+ metadata.gz: 9b7ddb265232987ce2e1212c9b2ffdd3ea19d96b33d567239045d86ceb44f548
4
+ data.tar.gz: 6fbc88e44f46b7052145b862ce169506f36f84564e09c037c113e0b9983162bc
5
5
  SHA512:
6
- metadata.gz: 21126d3193d8614a5b4d31236c1a9fe15153e8e3b07331dfc5a8bc08cd0f76b853d06585e2abcde523ecefe851a99d7234f919cbbf0177978c71abba49fe4c4b
7
- data.tar.gz: 815660743e328ec45f474e38511b94802adb3e5e1d8449c7a0cf8377168cf6fb8dccdd50ba7d211bac4131d15e354f0727718c29633a9ec62b77bd15937b4e52
6
+ metadata.gz: b277f53040d6310afc960bc6aba9ef750db3819d0dd6fa72b39540c2707dc2e93fb298092d3affbb14508eb641154f76728bfdfa5e725335967b79df5cb3bb85
7
+ data.tar.gz: 80b7204593fbb94a92f769b17ead95897530c2fe9f07d23c7566b2b26246e2ac0e4b5586818bb014f7ab10b4e41d465d9c9176554c512a5c95e4740addfbe86e
data/README.md CHANGED
@@ -7,12 +7,12 @@ At the [Isomorfeus Framework Project](http://isomorfeus.com)
7
7
 
8
8
  ## Versioning
9
9
  isomorfeus-redux version follows the Redux version which features and API it implements.
10
- Isomorfeus-redux 4.0.x implements features and the API of Redux 4.0 and should be used with Redux 4.0
10
+ Isomorfeus-redux 4.1.x implements features and the API of Redux 4.1 and should be used with Redux 4.1
11
11
 
12
12
  ## Installation
13
13
  To install redux with the matching version:
14
14
  ```
15
- yarn add redux@4.0.5
15
+ yarn add redux@4.1.0
16
16
  ```
17
17
  then add to the Gemfile:
18
18
  ```ruby
@@ -34,11 +34,117 @@ For full functionality the following are required:
34
34
  For the Gemfile:
35
35
  ```ruby
36
36
  gem 'opal', github: 'janbiedermann/opal', branch: 'es6_modules_1_1'
37
- gem 'opal-webpack-loader', '~> 0.9.1'
38
- gem 'opal-autoloader', '~> 0.0.3'
37
+ gem 'opal-webpack-loader', '~> 0.10.1'
39
38
  ```
40
39
 
41
- ## Usage
40
+ ## Usage within Isomorfeus
41
+
42
+ Lucid Components have store access integrated, see the isomorfeus-react documentation.
43
+
44
+ The following stores are available:
45
+ - AppStore - reactive store managed by redux
46
+ - LocalStore - convenient access to the Browsers localStorage, changes from within ruby can be subscribed to
47
+ - SessionStore - convenient access to the Browsers sessionStorage, changes from within ruby can be subscribed to
48
+
49
+ ### AppStore
50
+ All keys must be Strings or Symbols! All values must be serializable, simple types preferred!
51
+
52
+ Example Usage:
53
+ ```ruby
54
+ # setting a value:
55
+ AppStore.some_key = 10
56
+ AppStore[:some_key] = 10
57
+ AppStore.set(:some_key, 10)
58
+ AppStore.promise_set(:some_key, 10)
59
+
60
+ # getting a value:
61
+ val = AppStore.some_key
62
+ val = AppStore[:some_key]
63
+ val = AppStore.get(:some_key)
64
+ AppStore.promise_get(:some_key).then do |val|
65
+ # do something
66
+ end
67
+
68
+ # subscribing to changes
69
+ unsub = AppStore.subscribe do
70
+ @val = AppStore.some_key
71
+ end
72
+
73
+ # MUST be unsibscribed if changes are no longer wanted
74
+ AppStore.unsubscribe(unsub)
75
+ ```
76
+
77
+ ### LocalStore
78
+ All keys and values must be Strings or Symbols!
79
+
80
+ ```ruby
81
+ # setting a value:
82
+ LocalStore.some_key = 10
83
+ LocalStore[:some_key] = 10
84
+ LocalStore.set(:some_key, 10)
85
+ LocalStore.promise_set(:some_key, 10)
86
+
87
+ # getting a value:
88
+ val = LocalStore.some_key
89
+ val = LocalStore[:some_key]
90
+ val = LocalStore.get(:some_key)
91
+ LocalStore.promise_get(:some_key).then do |val|
92
+ # do something
93
+ end
94
+
95
+ # deleting a value
96
+ LocalStore.delete(:some_key)
97
+ LocalStore.promise_delete(:some_key)
98
+
99
+ # clearing the store
100
+ LocalStore.clear
101
+ LocalStore.promise_clear
102
+
103
+ # subscribing to changes
104
+ unsub = LocalStore.subscribe do
105
+ @val = LocalStore.some_key
106
+ end
107
+
108
+ # MUST be unsibscribed if changes are no longer wanted
109
+ LocalStore.unsubscribe(unsub)
110
+ ```
111
+
112
+ ### SessionStore
113
+ All keys and values must be Strings or Symbols!
114
+
115
+ ```ruby
116
+ # setting a value:
117
+ SessionStore.some_key = 10
118
+ SessionStore[:some_key] = 10
119
+ SessionStore.set(:some_key, 10)
120
+ SessionStore.promise_set(:some_key, 10)
121
+
122
+ # getting a value:
123
+ val = SessionStore.some_key
124
+ val = SessionStore[:some_key]
125
+ val = SessionStore.get(:some_key)
126
+ SessionStore.promise_get(:some_key).then do |val|
127
+ # do something
128
+ end
129
+
130
+ # deleting a value
131
+ SessionStore.delete(:some_key)
132
+ SessionStore.promise_delete(:some_key)
133
+
134
+ # clearing the store
135
+ SessionStore.clear
136
+ SessionStore.promise_clear
137
+
138
+ # subscribing to changes
139
+ unsub = SessionStore.subscribe do
140
+ @val = SessionStore.some_key
141
+ end
142
+
143
+ # MUST be unsibscribed if changes are no longer wanted
144
+ LocalStore.unsubscribe(unsub)
145
+ ```
146
+
147
+ ## Advanced Usage
42
148
  Because isomorfeus-redux follows closely the Redux principles/implementation/API and Documentation, most things of the official Redux documentation
43
149
  apply, but in the Ruby way, see:
44
150
  - https://redux.js.org
@@ -102,6 +208,7 @@ Isomorfeus.store.subscribe do
102
208
  # something useful here
103
209
  end
104
210
  ```
211
+
105
212
  ### Setup
106
213
  If isomorfeus-redux is used in isolation, these methods can be used:
107
214
  ```ruby
@@ -111,3 +218,6 @@ Redux::Store.init! # initializes the global store
111
218
 
112
219
  ### Development Tools
113
220
  The Redux Development Tools allow for detailed debugging of store/state changes: https://github.com/zalmoxisus/redux-devtools-extension
221
+
222
+ ### Specs
223
+ Specs for the stores are in isomorfeus-react.
data/lib/app_store.rb ADDED
@@ -0,0 +1,42 @@
1
+ class AppStore
2
+ class << self
3
+ def method_missing(key, *args, &block)
4
+ if `args.length > 0`
5
+ # set class state, simply a dispatch
6
+ action = { type: 'APPLICATION_STATE', name: (`key.endsWith('=')` ? key.chop : key), value: args[0] }
7
+ Isomorfeus.store.collect_and_defer_dispatch(action)
8
+ else
9
+ # check store for value
10
+ a_state = Isomorfeus.store.get_state
11
+ if a_state.key?(:application_state) && a_state[:application_state].key?(key)
12
+ return a_state[:application_state][key]
13
+ end
14
+
15
+ # otherwise return nil
16
+ return nil
17
+ end
18
+ end
19
+
20
+ alias [] method_missing
21
+ alias []= method_missing
22
+
23
+ alias get method_missing
24
+ alias set method_missing
25
+
26
+ def promise_get(key)
27
+ Promise.new.resolve(get(key))
28
+ end
29
+
30
+ def promise_set(key, value)
31
+ Promise.new.resolve(set(key, value))
32
+ end
33
+
34
+ def subscribe(&block)
35
+ Isomorfeus.store.subscribe(&block)
36
+ end
37
+
38
+ def unsubscribe(unsubscriber)
39
+ `unsubscriber()`
40
+ end
41
+ end
42
+ end
@@ -1,14 +1,20 @@
1
1
  require 'opal'
2
+ require 'isomorfeus/execution_environment'
3
+ require 'isomorfeus/core_ext/kernel'
4
+
2
5
  if RUBY_ENGINE == 'opal'
3
6
  require 'native'
4
7
  require 'promise'
8
+ require 'securerandom'
5
9
  require 'isomorfeus/core_ext/hash/deep_merge'
6
- require 'isomorfeus/execution_environment'
7
- require 'isomorfeus/execution_environment_helpers'
8
10
  require 'redux'
9
11
  require 'redux/store'
10
12
  require 'redux/reducers'
11
13
  require 'isomorfeus/redux_config'
14
+ require 'isomorfeus/browser_store_api'
15
+ require 'local_store'
16
+ require 'session_store'
17
+ require 'app_store'
12
18
 
13
19
  Redux::Reducers::add_application_reducers_to_store
14
20
  Isomorfeus.init_store
@@ -17,8 +23,6 @@ else
17
23
  promise_path = File.join(opal_path, 'stdlib', 'promise.rb')
18
24
  require promise_path
19
25
  require 'redux/version'
20
- require 'isomorfeus/execution_environment'
21
- require 'isomorfeus/execution_environment_helpers'
22
26
 
23
27
  Opal.append_path(__dir__.untaint)
24
28
 
@@ -0,0 +1,43 @@
1
+ module Isomorfeus
2
+ module BrowserStoreApi
3
+ def promise_get(key)
4
+ Promise.new.resolve(get(key))
5
+ end
6
+
7
+ def promise_set(key, value)
8
+ Promise.new.resolve(set(key, value))
9
+ end
10
+
11
+ def promise_delete(key)
12
+ Promise.new.resolve(delete(key))
13
+ end
14
+
15
+ def promise_clear
16
+ Promise.new.resolve(clear)
17
+ end
18
+
19
+ def subscribe(&block)
20
+ key = SecureRandom.uuid
21
+ subscribers[key] = block
22
+ key
23
+ end
24
+
25
+ def unsubscribe(key)
26
+ subscribers.delete(key)
27
+ nil
28
+ end
29
+
30
+ def notify_subscribers
31
+ return if subscribers.empty?
32
+ after 0 do
33
+ subscribers.each_value do |block|
34
+ block.call
35
+ end
36
+ end
37
+ end
38
+
39
+ def subscribers
40
+ @subscribers ||= {}
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,30 @@
1
+ module Kernel
2
+ def promise_after(time_ms)
3
+ p = Promise.new
4
+ after(time_ms) { p.resolve(true) }
5
+ p
6
+ end
7
+
8
+ def on_browser?; Isomorfeus.on_browser?; end
9
+ def on_ssr?; Isomorfeus.on_ssr?; end
10
+ def on_server?; Isomorfeus.on_server?; end
11
+ def on_desktop?; Isomorfeus.on_desktop?; end
12
+ def on_ios?; Isomorfeus.on_ios?; end
13
+ def on_android?; Isomorfeus.on_android?; end
14
+ def on_mobile?; Isomorfeus.on_mobile?; end
15
+ def on_database?; Isomorfeus.on_database?; end
16
+ def on_tvos?; Isomorfeus.on_tvos?; end
17
+ def on_androidtv?; Isomorfeus.on_androidtv?; end
18
+ def on_tv?; Isomorfeus.on_tv?; end
19
+
20
+ if RUBY_ENGINE == 'opal'
21
+ def after(time_ms, &block)
22
+ `setTimeout(#{block.to_n}, time_ms)`
23
+ end
24
+ else
25
+ def after(time_ms, &block)
26
+ sleep time_ms/1000
27
+ block.call
28
+ end
29
+ end
30
+ end
@@ -8,7 +8,11 @@ module Isomorfeus
8
8
  attr_accessor :on_ios
9
9
  attr_accessor :on_android
10
10
  attr_accessor :on_mobile
11
+ attr_accessor :on_pad
11
12
  attr_accessor :on_database
13
+ attr_accessor :on_tvos
14
+ attr_accessor :on_androidtv
15
+ attr_accessor :on_tv
12
16
 
13
17
  def on_browser?
14
18
  # true if running on browser
@@ -45,33 +49,59 @@ module Isomorfeus
45
49
  @on_mobile
46
50
  end
47
51
 
52
+ def on_pad?
53
+ # true if running on a pad
54
+ @on_pad
55
+ end
56
+
48
57
  def on_database?
49
58
  # true if running in database context
50
59
  @on_database
51
60
  end
61
+
62
+ def on_tvos?
63
+ # true if running in react-native on tvOS
64
+ @on_tvos
65
+ end
66
+
67
+ def on_androidtv?
68
+ # true if running in react-native on androidtv
69
+ @on_androidtv
70
+ end
71
+
72
+ def on_tv?
73
+ # true if running in react-native on a tv
74
+ @on_tv
75
+ end
52
76
  end
53
77
 
54
- self.on_ssr = `(typeof process === 'object' && typeof process.release === 'object' && typeof process.release.name === 'string' && process.release.name === 'node') ? true : false`
55
- self.on_desktop = `(typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.toLowerCase().indexOf(' electron/') > -1) ? true : false`
56
- self.on_ios = `(typeof Platform === 'object' && typeof Platform.OS === 'string' && Platform.OS.toLowerCase().includes?('ios')) ? true : false`
57
- self.on_android = `(typeof Platform === 'object' && typeof Platform.OS === 'string' && Platform.OS.toLowerCase().includes?('android')) ? true : false`
58
- self.on_mobile = self.on_ios? || self.on_android?
59
- self.on_database = false
60
- self.on_browser = !self.on_ssr? && !self.on_desktop? && !self.on_mobile? && !self.on_database?
61
- self.on_server = false
78
+ self.on_ssr = `(typeof process === 'object' && typeof process.release === 'object' && typeof process.release.name === 'string' && process.release.name === 'node') ? true : false`
79
+ self.on_desktop = false
80
+ self.on_ios = `(typeof Platform === 'object' && Platform.OS.toLowerCase().includes('ios')) ? true : false`
81
+ self.on_android = `(typeof Platform === 'object' && Platform.OS.toLowerCase().includes('android')) ? true : false`
82
+ self.on_pad = `(typeof Platform === 'object') ? (Platform.OS.toLowerCase().includes('ios') && Platform.isPad) : false`
83
+ self.on_tvos = `(typeof Platform === 'object') ? (Platform.isTV && Platform.OS.toLowerCase().includes('ios') && Platform.isTVOS) : false`
84
+ self.on_androidtv = `(typeof Platform === 'object') ? (Platform.isTV && Platform.OS.toLowerCase().includes('android')) : false`
85
+ self.on_tv = `(typeof Platform === 'object') ? Platform.isTV : false`
86
+ self.on_mobile = self.on_ios? || self.on_android?
87
+ self.on_database = false
88
+ self.on_server = false
89
+ self.on_browser = !self.on_ssr? && !self.on_desktop? && !self.on_mobile? && !self.on_database? && !self.on_tv?
62
90
  else
63
91
  class << self
64
- def on_ssr?; false; end
65
- def on_desktop?; false; end
66
- def on_ios?; false; end
67
- def on_android?; false; end
68
- def on_mobile?; false; end
69
- def on_database?; false; end
70
- def on_browser?; false; end
92
+ def on_ssr?; false; end
93
+ def on_desktop?; false; end
94
+ def on_ios?; false; end
95
+ def on_android?; false; end
96
+ def on_mobile?; false; end
97
+ def on_pad?; false; end
98
+ def on_database?; false; end
99
+ def on_browser?; false; end
100
+ def on_tvos?; false; end
101
+ def on_androidtv?; false; end
102
+ def on_tv?; false; end
71
103
 
72
- def on_server?
73
- true # so true ...
74
- end
104
+ def on_server?; true; end
75
105
  end
76
106
  end
77
107
  end
@@ -0,0 +1,41 @@
1
+ class LocalStore
2
+ extend Isomorfeus::BrowserStoreApi
3
+
4
+ class << self
5
+ def method_missing(key, *args, &block)
6
+ if Isomorfeus.on_browser?
7
+ if `args.length > 0`
8
+ key = `key.endsWith('=')` ? key.chop : key
9
+ value = args[0]
10
+ `Opal.global.localStorage.setItem(key, value)`
11
+ notify_subscribers
12
+ value
13
+ else
14
+ # check store for value
15
+ value = `Opal.global.localStorage.getItem(key)`
16
+ return value if value
17
+ end
18
+ end
19
+ # otherwise return nil
20
+ return nil
21
+ end
22
+
23
+ alias [] method_missing
24
+ alias []= method_missing
25
+
26
+ alias get method_missing
27
+ alias set method_missing
28
+
29
+ def delete(key)
30
+ `Opal.global.localStorage.removeItem(key)`
31
+ notify_subscribers
32
+ nil
33
+ end
34
+
35
+ def clear
36
+ `Opal.global.localStorage.clear()`
37
+ notify_subscribers
38
+ nil
39
+ end
40
+ end
41
+ end
@@ -10,7 +10,13 @@ module Redux
10
10
  action[:set_state]
11
11
  else
12
12
  new_state = {}.merge!(prev_state) # make a copy of state
13
- new_state.merge!(action[:name] => action[:value])
13
+ if action.key?(:collected)
14
+ action[:collected].each do |act|
15
+ new_state.merge!(act[:name] => act[:value])
16
+ end
17
+ else
18
+ new_state.merge!(action[:name] => action[:value])
19
+ end
14
20
  new_state
15
21
  end
16
22
  else
@@ -18,8 +24,53 @@ module Redux
18
24
  end
19
25
  end
20
26
 
21
- Redux::Store.preloaded_state_merge!(application_state: {})
22
- Redux::Store.add_reducers(application_state: app_reducer)
27
+ instance_reducer = Redux.create_reducer do |prev_state, action|
28
+ case action[:type]
29
+ when 'INSTANCE_STATE'
30
+ if action.key?(:set_state)
31
+ action[:set_state]
32
+ else
33
+ new_state = {}.merge!(prev_state) # make a copy of state
34
+ if action.key?(:collected)
35
+ action[:collected].each do |act|
36
+ new_state[act[:object_id]] = {} unless new_state.key?(act[:object_id])
37
+ new_state[act[:object_id]].merge!(act[:name] => act[:value])
38
+ end
39
+ else
40
+ new_state[action[:object_id]] = {} unless new_state.key?(action[:object_id])
41
+ new_state[action[:object_id]].merge!(action[:name] => action[:value])
42
+ end
43
+ new_state
44
+ end
45
+ else
46
+ prev_state
47
+ end
48
+ end
49
+
50
+ class_reducer = Redux.create_reducer do |prev_state, action|
51
+ case action[:type]
52
+ when 'CLASS_STATE'
53
+ if action.key?(:set_state)
54
+ action[:set_state]
55
+ else
56
+ new_state = {}.merge!(prev_state) # make a copy of state
57
+ if action.key?(:collected)
58
+ action[:collected].each do |act|
59
+ new_state[act[:class]] = {} unless new_state.key?(act[:class])
60
+ new_state[act[:class]].merge!(act[:name] => act[:value])
61
+ end
62
+ else
63
+ new_state[action[:class]] = {} unless new_state.key?(action[:class])
64
+ new_state[action[:class]].merge!(action[:name] => action[:value])
65
+ end
66
+ new_state
67
+ end
68
+ else
69
+ prev_state
70
+ end
71
+ end
72
+ Redux::Store.preloaded_state_merge!(application_state: {}, instance_state: {}, class_state: {})
73
+ Redux::Store.add_reducers(application_state: app_reducer, instance_state: instance_reducer, class_state: class_reducer)
23
74
  end
24
75
  end
25
76
  end
data/lib/redux/store.rb CHANGED
@@ -125,16 +125,18 @@ module Redux
125
125
  Hash.new(`this.native.getState()`)
126
126
  end
127
127
 
128
- def merge_and_defer_dispatch(action)
129
- if Isomorfeus.on_browser?
128
+ def collect_and_defer_dispatch(action)
129
+ if !Isomorfeus.on_ssr?
130
130
  type = action.delete(:type)
131
- @deferred_actions[type] = {} unless @deferred_actions.key?(type)
132
- @deferred_actions[type].deep_merge!(action)
133
- @last_dispatch_time = `new Date()`
134
- create_deferred_dispatcher(`new Date()`) unless @deferred_dispatcher
131
+ @deferred_actions[type] = [] unless @deferred_actions.key?(type)
132
+ @deferred_actions[type].push(action)
133
+ @last_dispatch_time = `Date.now()`
134
+ # `console.log(#@last_dispatch_time)`
135
+ deferred_dispatcher(`Date.now()`) unless @deferred_dispatcher
135
136
  else
136
137
  dispatch(action)
137
138
  end
139
+ nil
138
140
  end
139
141
 
140
142
  def replace_reducer(next_reducer)
@@ -143,35 +145,39 @@ module Redux
143
145
 
144
146
  # returns function needed to unsubscribe the listener
145
147
  def subscribe(&listener)
146
- `this.native.subscribe(function() { return listener$.call(); })`
148
+ `this.native.subscribe(function() { return listener.$call(); })`
147
149
  end
148
150
 
149
151
  private
150
152
 
151
- def create_deferred_dispatcher(first)
153
+ def deferred_dispatcher(first)
152
154
  @deferred_dispatcher = true
153
155
  %x{
154
156
  setTimeout(function() {
155
- if (#{wait_longer?(first)}) { #{create_deferred_dispatcher(first)} }
157
+ if (#{wait_longer?(first)}) { #{deferred_dispatcher(first)} }
156
158
  else { #{dispatch_deferred_dispatches} }
157
- }, 25)
159
+ }, 10)
158
160
  }
159
161
  end
160
162
 
161
163
  def dispatch_deferred_dispatches
164
+ # `console.log(Date.now())`
162
165
  @deferred_dispatcher = false
163
166
  actions = @deferred_actions
164
167
  @deferred_actions = {}
165
168
  actions.each do |type, data|
166
- dispatch({type: type}.merge(data))
169
+ dispatch(type: type, collected: data)
167
170
  end
168
171
  end
169
172
 
170
173
  def wait_longer?(first)
171
- t = `new Date()`
172
- return false if (`t - first`) > 50 # ms
173
- return false if (`t - #@last_dispatch_time`) > 10 # ms
174
+ t = `Date.now()`
175
+ time_since_first = `t - first`
176
+ # `console.log('delta', time_since_first)`
177
+ return true if `typeof Opal.React !== 'undefined' && typeof Opal.React.render_buffer !== 'undefined' && Opal.React.render_buffer.length > 0 && time_since_first < 1000`
178
+ return false if time_since_first > 100 # ms
179
+ return false if (`t - #@last_dispatch_time`) > 9 # ms
174
180
  return true
175
181
  end
176
182
  end
177
- end
183
+ end
data/lib/redux/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Redux
2
- VERSION = '4.0.20'
2
+ VERSION = '4.1.1'
3
3
  end
@@ -0,0 +1,41 @@
1
+ class SessionStore
2
+ extend Isomorfeus::BrowserStoreApi
3
+
4
+ class << self
5
+ def method_missing(key, *args, &block)
6
+ if Isomorfeus.on_browser?
7
+ if `args.length > 0`
8
+ key = `key.endsWith('=')` ? key.chop : key
9
+ value = args[0]
10
+ `Opal.global.sessionStorage.setItem(key, value)`
11
+ notify_subscribers
12
+ value
13
+ else
14
+ # check store for value
15
+ value = `Opal.global.sessionStorage.getItem(key)`
16
+ return value if value
17
+ end
18
+ end
19
+ # otherwise return nil
20
+ return nil
21
+ end
22
+
23
+ alias [] method_missing
24
+ alias []= method_missing
25
+
26
+ alias get method_missing
27
+ alias set method_missing
28
+
29
+ def delete(key)
30
+ `Opal.global.sessionStorage.removeItem(key)`
31
+ notify_subscribers
32
+ nil
33
+ end
34
+
35
+ def clear
36
+ `Opal.global.sessionStorage.clear()`
37
+ notify_subscribers
38
+ nil
39
+ end
40
+ end
41
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-redux
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.20
4
+ version: 4.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-22 00:00:00.000000000 Z
11
+ date: 2021-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: Use a global store and write reducers for it in Opal Ruby.
41
+ description: Use different stores within Isomorfeus and write reducers for redux.
42
42
  email:
43
43
  - jan@kursator.com
44
44
  executables: []
@@ -46,22 +46,25 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - README.md
49
+ - lib/app_store.rb
49
50
  - lib/isomorfeus-redux.rb
51
+ - lib/isomorfeus/browser_store_api.rb
50
52
  - lib/isomorfeus/core_ext/hash/deep_merge.rb
53
+ - lib/isomorfeus/core_ext/kernel.rb
51
54
  - lib/isomorfeus/execution_environment.rb
52
- - lib/isomorfeus/execution_environment_helpers.rb
53
- - lib/isomorfeus/promise.rb
54
55
  - lib/isomorfeus/redux_config.rb
56
+ - lib/local_store.rb
55
57
  - lib/redux.rb
56
58
  - lib/redux/reducers.rb
57
59
  - lib/redux/store.rb
58
60
  - lib/redux/version.rb
61
+ - lib/session_store.rb
59
62
  homepage: http://isomorfeus.com
60
63
  licenses:
61
64
  - MIT
62
65
  metadata:
63
66
  github_repo: ssh://github.com/isomorfeus/gems
64
- post_install_message:
67
+ post_install_message:
65
68
  rdoc_options: []
66
69
  require_paths:
67
70
  - lib
@@ -76,8 +79,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
79
  - !ruby/object:Gem::Version
77
80
  version: '0'
78
81
  requirements: []
79
- rubygems_version: 3.0.6
80
- signing_key:
82
+ rubygems_version: 3.2.15
83
+ signing_key:
81
84
  specification_version: 4
82
- summary: Redux for Opal Ruby.
85
+ summary: Redux and Stores for Isomorfeus.
83
86
  test_files: []
@@ -1,12 +0,0 @@
1
- module Isomorfeus
2
- module ExecutionEnvironmentHelpers
3
- def on_browser?; Isomorfeus.on_browser?; end
4
- def on_ssr?; Isomorfeus.on_ssr?; end
5
- def on_desktop?; Isomorfeus.on_desktop?; end
6
- def on_ios?; Isomorfeus.on_ios?; end
7
- def on_android?; Isomorfeus.on_android?; end
8
- def on_mobile?; Isomorfeus.on_mobile?; end
9
- def on_database?; Isomorfeus.on_database?; end
10
- def on_server?; Isomorfeus.on_server?; end
11
- end
12
- end
@@ -1,3 +0,0 @@
1
- opal_path = Gem::Specification.find_by_name('opal').full_gem_path
2
- promise_path = File.join(opal_path, 'stdlib', 'promise.rb')
3
- require promise_path