@@ -16,30 +16,36 @@ A plugin is an object that contains the following fields.
1616 // Initialize the plugin's data.
1717 // This is stored in a special area of the state object
1818 // and not exposed to the move functions.
19- setup : ({ ctx }) => object,
19+ setup : ({ G , ctx, game }) => data object,
2020
2121 // Create an object that becomes available in `ctx`
2222 // under `ctx['plugin-name']`.
2323 // This is called at the beginning of a move or event.
2424 // This object will be held in memory until flush (below)
2525 // is called.
26- api : ({ G , ctx, data }) => object,
26+ api : ({ G , ctx, game, data, playerID }) => api object,
2727
2828 // Return an updated version of data that is persisted
2929 // in the game's state object.
30- flush : ({ G , ctx, data, api }) => object,
30+ flush : ({ G , ctx, game, data, api }) => data object,
3131
3232 // Function that accepts a move / trigger function
3333 // and returns another function that wraps it. This
3434 // wrapper can modify G before passing it down to
3535 // the wrapped function. It is a good practice to
3636 // undo the change at the end of the call.
37- fnWrap : (fn , game ) => (G , ctx , ... args ) => {
37+ fnWrap : (fn ) => (G , ctx , ... args ) => {
3838 G = preprocess (G );
3939 G = fn (G , ctx, ... args);
4040 G = postprocess (G );
4141 return G ;
4242 },
43+
44+ // Function that allows the plugin to indicate that it
45+ // should not be run on the client. If it returns true,
46+ // the client will discard the state update and wait
47+ // for the master instead.
48+ noClient : ({ G , ctx, game, data, api }) => boolean,
4349}
4450```
4551
0 commit comments