Comparing version 0.5.0 to 0.6.0
{ | ||
"name": "jeux", | ||
"version": "0.5.0", | ||
"description": "App Container", | ||
"version": "0.6.0", | ||
"description": "Javascript state container", | ||
"main": "lib/jeux.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -6,7 +6,50 @@ # API | ||
# 2nd-level API | ||
* dispatch() | ||
* dispatch(action) | ||
* subscribe(callback(newState)) | ||
* getState() | ||
## Store | ||
The store is nothing but a js object that holds your application state | ||
## Reducers | ||
Reducers are functions that accept the current slice of the state that the reducer responds to and the current action being dispatched. | ||
## Middleware | ||
Middleware are functions that are called before an action gets to any reducers. | ||
Normal flow --- dispatch action --- reducers --- updated state | ||
Flow with middleware --- dispatch action --- passes action through middlewares --- reducers --- updated state | ||
## createStore | ||
CreateStore accepts the reducer object as a first arg. This is a mapping of keys to functions. | ||
See Examples below for more details. | ||
## dispatch | ||
This method is used to dispatch actions to the store and the store takes the actions runs it through the reducers and updates | ||
the state accordingly. | ||
most actions look like this | ||
```javascript | ||
{ | ||
type : "FETCH_USER", | ||
extraField : "someData" | ||
} | ||
``` | ||
## subscribe | ||
This method is to be used if you would like to know when changes to the store have occurred. Ths method accepts | ||
a callback function that is invoked when the store changes. | ||
## getState | ||
The methods returns the current state of your application | ||
## Examples | ||
@@ -13,0 +56,0 @@ |
@@ -1,3 +0,3 @@ | ||
const chainer = (starter, mw) => { | ||
const args = [starter, ...mw]; | ||
const chainer = (starter, middleware) => { | ||
const args = [starter, ...middleware]; | ||
const functions = []; | ||
@@ -4,0 +4,0 @@ |
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
61275
88
0