Skip to content

Commit aeff678

Browse files
patinthehatPatrick
authored andcommitted
update readme with info/examples on filtering tracked state props
1 parent 1308b9e commit aeff678

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,15 @@ const storeObj = {
214214
},
215215
actions: {},
216216
modules: {},
217-
plugins: [RayVuexPlugin({ trackState: true, logMutations: true })],
217+
plugins: [
218+
RayVuexPlugin({
219+
trackState: true,
220+
logMutations: true,
221+
trackingOptions: {
222+
propNames: ['on*'],
223+
}
224+
}),
225+
],
218226
};
219227

220228
// Vue 3:
@@ -233,9 +241,28 @@ export default new Vuex.Store(storeObj);
233241
| `logActions` | `boolean` | log all fired actions to Ray |
234242
| `loggedMutationColor` | `string` | send logged mutations with the specified Ray color |
235243
| `loggedActionColor` | `string` | send logged actions with the specified Ray color |
244+
| `trackingOptions` | `object` | see "tracking options" section for more info |
236245

237246
Valid color names are `blue`, `gray`, `green`, `orange`, `purple`, `red`, and `none`.
238247

248+
### Tracking options
249+
250+
The `trackingOptions` definition is as follows:
251+
252+
```typescript
253+
trackingOptions?: {
254+
moduleNames?: string[];
255+
propNames?: string[];
256+
};
257+
```
258+
259+
The `propNames` is an array of wildcard patterns that will be used to match store data property names when tracking store state; for example, a value of `['f*']` would match store data properties named `foo` and `fab` but not `dog`.
260+
261+
The `moduleNames` is also an array of wildcard patterns, but will match module names and module data property names, such as `['mymod.*']`, which would match all properties in the `mymod` store.
262+
263+
The default value for both is `['*']`, meaning all modules and properties match.
264+
265+
239266
## Development setup
240267

241268
- `npm install`

0 commit comments

Comments
 (0)