isomorfeus-redux 4.0.19 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0eabc9771d1a6cd01277a34a779def3b54053a6cf18d81ed659a39cdbce6e84b
4
- data.tar.gz: 8474fbbb10aa537d2136484e36938d66a6c3ba118854ee7db441d0cd6ab7678a
3
+ metadata.gz: eee10cde82ff56029869c6158c2e0eb99dc5df7bf7746920d2d155023870cc51
4
+ data.tar.gz: 312c159a65766706fb871cca8caf8d5c3d8cf037fb6bdb6384b5933c5821f113
5
5
  SHA512:
6
- metadata.gz: 9e1bbc10687e598ba74712425f84165ca3a89ad373a62f1ccd21381b3420f5f9d2d60a8dc953b30dddfe9d830fa3dbd443c575c81d30f75b98c6aad3a531bbc4
7
- data.tar.gz: 2a720626c51e0c24764c0afb8bcaa825a39e929ac45475ddec90b7a933a982b54f718908b6cf2343e375dc3fba3dfe7b12d21bd4cae6a5efe3dec801bfb59702
6
+ metadata.gz: a38191643a83bec9f169c8d645c076a539408d3ea4417c11c284a3b91ccf3ce6ca0fafe2105f5da1a5c051d0bdab18118735c8eee22dd771654b478c6529e3b9
7
+ data.tar.gz: baf7135019055ef0377a1a542130482dec78cd7119bc9d1c20f55294f645492d49fa122bfc067fec7c55ddcce199abc563fec9b3f8402b3154912cedc6aace26
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,13 +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
10
  require 'redux'
8
11
  require 'redux/store'
9
12
  require 'redux/reducers'
10
13
  require 'isomorfeus/redux_config'
14
+ require 'isomorfeus/browser_store_api'
15
+ require 'local_store'
16
+ require 'session_store'
17
+ require 'app_store'
11
18
 
12
19
  Redux::Reducers::add_application_reducers_to_store
13
20
  Isomorfeus.init_store
@@ -16,7 +23,6 @@ else
16
23
  promise_path = File.join(opal_path, 'stdlib', 'promise.rb')
17
24
  require promise_path
18
25
  require 'redux/version'
19
- require 'isomorfeus/execution_environment'
20
26
 
21
27
  Opal.append_path(__dir__.untaint)
22
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
@@ -9,6 +9,9 @@ module Isomorfeus
9
9
  attr_accessor :on_android
10
10
  attr_accessor :on_mobile
11
11
  attr_accessor :on_database
12
+ attr_accessor :on_tvos
13
+ attr_accessor :on_androidtv
14
+ attr_accessor :on_tv
12
15
 
13
16
  def on_browser?
14
17
  # true if running on browser
@@ -45,33 +48,59 @@ module Isomorfeus
45
48
  @on_mobile
46
49
  end
47
50
 
51
+ def on_pad?
52
+ # true if running on a pad
53
+ @on_pad
54
+ end
55
+
48
56
  def on_database?
49
57
  # true if running in database context
50
58
  @on_database
51
59
  end
60
+
61
+ def on_tvos?
62
+ # true if running in react-native on tvOS
63
+ @on_tvos
64
+ end
65
+
66
+ def on_androidtv?
67
+ # true if running in react-native on androidtv
68
+ @on_androidtv
69
+ end
70
+
71
+ def on_tv?
72
+ # true if running in react-native on a tv
73
+ @on_tv
74
+ end
52
75
  end
53
76
 
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
77
+ self.on_ssr = `(typeof process === 'object' && typeof process.release === 'object' && typeof process.release.name === 'string' && process.release.name === 'node') ? true : false`
78
+ self.on_desktop = false
79
+ self.on_ios = `(typeof Platform === 'object' && Platform.OS.toLowerCase().includes('ios')) ? true : false`
80
+ self.on_android = `(typeof Platform === 'object' && Platform.OS.toLowerCase().includes('android')) ? true : false`
81
+ self.on_pad = `(typeof Platform === 'object') ? (Platform.OS.toLowerCase().includes('ios') && Platform.isPad) : false`
82
+ self.on_tvos = `(typeof Platform === 'object') ? (Platform.isTV && Platform.OS.toLowerCase().includes('ios') && Platform.isTVOS) : false`
83
+ self.on_androidtv = `(typeof Platform === 'object') ? (Platform.isTV && Platform.OS.toLowerCase().includes('android')) : false`
84
+ self.on_tv = `(typeof Platform === 'object') ? Platform.isTV : false`
85
+ self.on_mobile = self.on_ios? || self.on_android?
86
+ self.on_database = false
87
+ self.on_server = false
88
+ self.on_browser = !self.on_ssr? && !self.on_desktop? && !self.on_mobile? && !self.on_database? && !self.on_tv?
62
89
  else
63
90
  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
91
+ def on_ssr?; false; end
92
+ def on_desktop?; false; end
93
+ def on_ios?; false; end
94
+ def on_android?; false; end
95
+ def on_mobile?; false; end
96
+ def on_pad?; false; end
97
+ def on_database?; false; end
98
+ def on_browser?; false; end
99
+ def on_tvos?; false; end
100
+ def on_androidtv?; false; end
101
+ def on_tv?; false; end
71
102
 
72
- def on_server?
73
- true # so true ...
74
- end
103
+ def on_server?; true; end
75
104
  end
76
105
  end
77
106
  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.19'
2
+ VERSION = '4.1.0'
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.19
4
+ version: 4.1.0
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,21 +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/promise.rb
53
55
  - lib/isomorfeus/redux_config.rb
56
+ - lib/local_store.rb
54
57
  - lib/redux.rb
55
58
  - lib/redux/reducers.rb
56
59
  - lib/redux/store.rb
57
60
  - lib/redux/version.rb
61
+ - lib/session_store.rb
58
62
  homepage: http://isomorfeus.com
59
63
  licenses:
60
64
  - MIT
61
65
  metadata:
62
66
  github_repo: ssh://github.com/isomorfeus/gems
63
- post_install_message:
67
+ post_install_message:
64
68
  rdoc_options: []
65
69
  require_paths:
66
70
  - lib
@@ -75,8 +79,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
79
  - !ruby/object:Gem::Version
76
80
  version: '0'
77
81
  requirements: []
78
- rubygems_version: 3.0.6
79
- signing_key:
82
+ rubygems_version: 3.2.15
83
+ signing_key:
80
84
  specification_version: 4
81
- summary: Redux for Opal Ruby.
85
+ summary: Redux and Stores for Isomorfeus.
82
86
  test_files: []
@@ -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