@@ -61,6 +61,10 @@ export default (initialState) => {
6161It wraps your store's root reducer (to store history), ` getState ` (to return the
6262current state in history) and ` dispatch ` (to connect to peers).
6363
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+
6468## options
6569
6670The store enhancer takes an options object, including the key
@@ -79,29 +83,43 @@ scuttlebutt({
7983
8084 // options passed through to the dispatcher (and their defaults)
8185 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+ }
97115})
98116```
99117
100- ### verifyAsync
118+ ### verifyAsync & signAsync
101119
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:
105123
106124``` js
107125import { UPDATE_ACTION } from ' redux-scuttlebutt'
0 commit comments