@inglorious/react-store 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/package.json +1 -1
- package/src/index.jsx +1 -1
package/README.md
CHANGED
|
@@ -65,10 +65,10 @@ import { store } from "./store"
|
|
|
65
65
|
// Eager mode (default) - updates process immediately
|
|
66
66
|
export const { Provider, useSelector, useNotify } = createReactStore(store)
|
|
67
67
|
|
|
68
|
-
// Or batched mode - updates process at
|
|
68
|
+
// Or batched mode - updates process at 20 FPS
|
|
69
69
|
// export const { Provider, useSelector, useNotify } = createReactStore(store, {
|
|
70
70
|
// mode: "batched",
|
|
71
|
-
// fps:
|
|
71
|
+
// fps: 20
|
|
72
72
|
// })
|
|
73
73
|
```
|
|
74
74
|
|
|
@@ -120,7 +120,7 @@ Creates React bindings for an Inglorious Store.
|
|
|
120
120
|
- `store` (required): An Inglorious Store instance
|
|
121
121
|
- `config` (optional): Configuration object
|
|
122
122
|
- `mode`: `"eager"` (default) or `"batched"`
|
|
123
|
-
- `fps`: Frame rate for batched mode (default:
|
|
123
|
+
- `fps`: Frame rate for batched mode (default: 20)
|
|
124
124
|
- `skippedEvents`: Array of event types to exclude from DevTools logging
|
|
125
125
|
|
|
126
126
|
**Returns:**
|
|
@@ -135,7 +135,7 @@ Creates React bindings for an Inglorious Store.
|
|
|
135
135
|
// Eager mode (immediate updates)
|
|
136
136
|
const { Provider, useSelector, useNotify } = createReactStore(store)
|
|
137
137
|
|
|
138
|
-
// Batched mode
|
|
138
|
+
// Batched mode for real-time apps
|
|
139
139
|
const { Provider, useSelector, useNotify } = createReactStore(store, {
|
|
140
140
|
mode: "batched",
|
|
141
141
|
fps: 30,
|
|
@@ -234,7 +234,7 @@ Best for performance-critical apps. Updates process on a fixed timer (FPS).
|
|
|
234
234
|
```javascript
|
|
235
235
|
const { Provider, useSelector, useNotify } = createReactStore(store, {
|
|
236
236
|
mode: "batched",
|
|
237
|
-
fps:
|
|
237
|
+
fps: 20, // Process events 20 times per second
|
|
238
238
|
})
|
|
239
239
|
```
|
|
240
240
|
|
|
@@ -248,8 +248,8 @@ const { Provider, useSelector, useNotify } = createReactStore(store, {
|
|
|
248
248
|
**FPS Guidelines:**
|
|
249
249
|
|
|
250
250
|
- **60 FPS** - Smooth animations, games
|
|
251
|
-
- **30 FPS
|
|
252
|
-
- **
|
|
251
|
+
- **30 FPS** - Good balance for most real-time apps
|
|
252
|
+
- **20 FPS (default)** - Input handling, live dashboards, lower CPU usage
|
|
253
253
|
- **5-10 FPS** - Background updates, status polling
|
|
254
254
|
|
|
255
255
|
---
|
|
@@ -268,7 +268,7 @@ Redux DevTools work automatically! Install the [browser extension](https://githu
|
|
|
268
268
|
// Skip noisy events from DevTools
|
|
269
269
|
const { Provider, useSelector, useNotify } = createReactStore(store, {
|
|
270
270
|
mode: "batched",
|
|
271
|
-
fps:
|
|
271
|
+
fps: 20,
|
|
272
272
|
skippedEvents: ["mousemove", "update"], // Don't log these
|
|
273
273
|
})
|
|
274
274
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inglorious/react-store",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Official React bindings for @inglorious/store. Provides hooks and a Provider to connect your React components to the store.",
|
|
5
5
|
"author": "IceOnFire <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
|
|
6
6
|
"license": "MIT",
|
package/src/index.jsx
CHANGED
|
@@ -4,7 +4,7 @@ import { Provider, useSelector } from "react-redux"
|
|
|
4
4
|
|
|
5
5
|
const DEFAULT_CONFIG = { mode: "eager" }
|
|
6
6
|
const ONE_SECOND = 1000
|
|
7
|
-
const DEFAULT_FPS =
|
|
7
|
+
const DEFAULT_FPS = 20
|
|
8
8
|
|
|
9
9
|
export function createReactStore(store, config = DEFAULT_CONFIG) {
|
|
10
10
|
if (config.mode === "batched") {
|