@@ -27,11 +27,10 @@ and changes will sync when you next connect to another scuttlebutt instance.
27
27
28
28
Note, by default, scuttlebutt itself does not make any guarantees of security or
29
29
identity: peer ` Bob ` is able to lie to ` Jane ` about ` Amy ` 's actions. Security
30
- guarantees can added using the
31
- [ ` signAsync ` and ` verifyAsync ` ] ( #signasync--verifyasync )] dispatcher options.
30
+ guarantees can added using the [ ` signAsync ` and ` verifyAsync ` ] ( #signasync--verifyasync )
31
+ dispatcher options.
32
32
33
- For more, read the
34
- [ Scuttlebutt paper] ( http://www.cs.cornell.edu/home/rvr/papers/flowgossip.pdf ) .
33
+ For more, read the [ Scuttlebutt paper] ( http://www.cs.cornell.edu/home/rvr/papers/flowgossip.pdf ) .
35
34
36
35
## dispatcher
37
36
@@ -58,12 +57,39 @@ export default (initialState) => {
58
57
}
59
58
```
60
59
61
- It wraps your store's root reducer (to store history), ` getState ` (to return the
62
- current state in history) and ` dispatch ` (to connect to peers).
60
+ It wraps your store's root reducer (to allow us to store history states),
61
+ ` getState ` (to return the latest history state) and ` dispatch ` (to dispatch
62
+ locally and to connected peers).
63
63
64
- If you're using the redux dev-tools enhancer, it must come * after* the redux-
65
- scuttlebutt enhancer (or scuttlebutt will emit ` PERFORM_ACTION ` actions over the
66
- network).
64
+ Actions which flow through redux-scuttlebutt will have their timestamp and
65
+ source added (as non-enumerable properties) to the action's meta object. These
66
+ keys are available as the exported constants ` META_TIMESTAMP ` and
67
+ ` META_SOURCE ` .
68
+
69
+ Timestamps are logical (not wall-clock based) and are in the format
70
+ ` <logical timestamp>-<source> ` .
71
+
72
+ ### redux-devtools
73
+
74
+ If you're using the
75
+ [ redux dev-tools enhancer] ( https://github.com/gaearon/redux-devtools ) , it must
76
+ come * after* the redux-scuttlebutt enhancer, otherwise connected scuttlebutt
77
+ stores will emit devtools actions instead of your application's. For ease of
78
+ development, we also export ` devToolsStateSanitizer ` which allows devtools to
79
+ expose your application's internal state (instead of scuttlebutt's):
80
+
81
+ ``` js
82
+ import scuttlebutt , { devToolsStateSanitizer } from ' redux-scuttlebutt'
83
+
84
+ const enhancer = compose (
85
+ scuttlebutt (),
86
+ window .__REDUX_DEVTOOLS_EXTENSION__
87
+ ? window .__REDUX_DEVTOOLS_EXTENSION__ ({ stateSanitizer: devToolsStateSanitizer })
88
+ : f => f
89
+ )
90
+
91
+ createStore (counter, undefined , enhancer)
92
+ ```
67
93
68
94
## options
69
95
@@ -140,9 +166,9 @@ scuttlebutt({
140
166
}))
141
167
```
142
168
143
- The ` getStateHistory ` parameter returns an array of the form
169
+ The ` getStateHistory ` third parameter returns an array of the form
144
170
` [UPDATE_ACTION, UPDATE_TIMESTAMP, UPDATE_SOURCE, UPDATE_SNAPSHOT] ` . These
145
- ` UPDATE_* ` constants are exported from scuttlebutt.
171
+ ` UPDATE_ ` constants are exported from scuttlebutt.
146
172
147
173
Note, if your verification is computationally expensive, you are responsible for
148
174
throttling/delay (like you might for
0 commit comments