@@ -61,6 +61,10 @@ export default (initialState) => {
61
61
It wraps your store's root reducer (to store history), ` getState ` (to return the
62
62
current state in history) and ` dispatch ` (to connect to peers).
63
63
64
+ If you're using the redux devtools enhancer, it must come * after* the redux-
65
+ scuttlebutt enhancer (or scuttlebutt will try to emit ` PERFORM_ACTION ` across
66
+ the network)
67
+
64
68
## options
65
69
66
70
The store enhancer takes an options object, including the key
@@ -79,29 +83,43 @@ scuttlebutt({
79
83
80
84
// options passed through to the dispatcher (and their defaults)
81
85
dispatcherOptions: {
82
- // the default will batch-reduce actions by the hundred, firing redux's
83
- // subscribe method on the last one, triggering the actual rendering on the
84
- // next animationFrame.
85
- // see: https://github.com/grrowl/redux-scuttlebutt/blob/master/src/dispatcher.js#L22
86
- customDispatch: getDelayedDispatch, // (dispatcher) => (action) => {}
87
-
88
- // returns whether an action's type should be broadcast to the network.
89
- // (returns false for @@INIT and internal @@scuttlebutt-prefixed action
90
- // types)
91
- isGossipType: isGossipType, // (actionType) => bool
92
-
93
- // if specified, the specified function must call the callback with false or
94
- // true, depending on whether the action is valid.
95
- verifyAsync, // (callback, action, getStateHistory) => {}
96
- },
86
+ customDispatch : function getDelayedDispatch (dispatcher ) {
87
+ return function (action ) {
88
+ // the default will batch-reduce actions by the hundred, firing redux's
89
+ // subscribe method on the last one, triggering the actual rendering on
90
+ // the next animationFrame.
91
+ // see: https://github.com/grrowl/redux-scuttlebutt/blob/master/src/dispatcher.js#L22
92
+ }
93
+ },
94
+
95
+ isGossipType : function (actionType ) {
96
+ // returns a boolean representing whether an action's type should be
97
+ // broadcast to the network.
98
+ // (by default, returns false for actions prefixed with @@, such as @@INIT
99
+ // and internal @@scuttlebutt-prefixed action types)
100
+ },
101
+
102
+ verifyAsync : function (callback , action , getStateHistory ) {
103
+ // if specified, the verifyAsync function must call callback(false) if the
104
+ // action is invalid, or callback(true) if the action is valid.
105
+ // getStateHistory() will return an array of ordered updates
106
+ },
107
+
108
+ signAsync : function (callback , action , getStateHistory ) {
109
+ // if specified, the signAsync will be called for every locally dispatched
110
+ // action. must call callback(action) and can mutate the action if
111
+ // desired.
112
+ // getStateHistory() will return an array of ordered updates
113
+ },
114
+ }
97
115
})
98
116
```
99
117
100
- ### verifyAsync
118
+ ### verifyAsync & signAsync
101
119
102
- The dispatcher option ` verifyAsync ` allows you to filter actions dispatched or
103
- gossiped about through scuttlebutt. You could validate an action's contents
104
- against a cryptographic signature, or rate limit, or an arbitrary rule:
120
+ The dispatcher option ` verifyAsync ` allows you to filter remote actions
121
+ dispatched or gossiped about through scuttlebutt. You could validate an action's
122
+ contents against a cryptographic signature, or rate limit, or an arbitrary rule:
105
123
106
124
``` js
107
125
import { UPDATE_ACTION } from ' redux-scuttlebutt'
0 commit comments