@fedeghe/pangjs 0.0.5 → 0.0.6
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 +13 -14
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# PANGjs (0.0.
|
|
1
|
+
# PANGjs (0.0.6)
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
@@ -29,16 +29,15 @@ const store = PANGjs.getStore( reducer, initState );
|
|
|
29
29
|
|
|
30
30
|
// stage the results only internally
|
|
31
31
|
store.stage({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
));
|
|
32
|
+
type: 'ADD',
|
|
33
|
+
payload: { number: 4 }
|
|
34
|
+
})
|
|
35
|
+
// here we get staged state
|
|
36
|
+
.then(console.log);
|
|
38
37
|
|
|
39
38
|
// make all staged changes effective
|
|
40
39
|
store.dispatch()
|
|
41
|
-
// here we get the
|
|
40
|
+
// here we get the state
|
|
42
41
|
.then(console.log);
|
|
43
42
|
```
|
|
44
43
|
alternatively one single call just adding `true` as second parameter also dispatch:
|
|
@@ -47,10 +46,10 @@ store.stage({
|
|
|
47
46
|
type: 'ADD',
|
|
48
47
|
payload: { number: 4 }
|
|
49
48
|
}, true /* autoDispatch */)
|
|
50
|
-
.then(console.log); // here we get
|
|
49
|
+
.then(console.log); // here we get the state
|
|
51
50
|
```
|
|
52
51
|
|
|
53
|
-
alternatively it is possible to directly
|
|
52
|
+
alternatively it is possible to directly dispatch the action:
|
|
54
53
|
``` js
|
|
55
54
|
store.dispatch({
|
|
56
55
|
type: 'ADD',
|
|
@@ -129,9 +128,9 @@ Every store obtained invoking successfully `PANGjs.getStore` exposes the followi
|
|
|
129
128
|
|
|
130
129
|
### `storeInstance.getState() -> state`
|
|
131
130
|
|
|
132
|
-
returns the
|
|
131
|
+
returns the state
|
|
133
132
|
|
|
134
|
-
### `storeInstance.stage(action,
|
|
133
|
+
### `storeInstance.stage(action, autoDispatch) -> Promise`
|
|
135
134
|
|
|
136
135
|
stage or stage&dispatch returning a promise resolving with new state (staged or not);
|
|
137
136
|
|
|
@@ -143,7 +142,7 @@ stage or stage&dispatch returning a promise resolving with new state (staged or
|
|
|
143
142
|
payload: <Object>
|
|
144
143
|
}
|
|
145
144
|
```
|
|
146
|
-
-
|
|
145
|
+
- autoDispatch `<Boolean>` default `false`
|
|
147
146
|
|
|
148
147
|
|
|
149
148
|
|
|
@@ -161,7 +160,7 @@ and as
|
|
|
161
160
|
|
|
162
161
|
### `storeInstance.subscribe(fn) -> unsubscribing function`
|
|
163
162
|
|
|
164
|
-
allows to register a subscribing function that will be invoked everytime the state changes (
|
|
163
|
+
allows to register a subscribing function that will be invoked everytime the state changes (dispatched)
|
|
165
164
|
|
|
166
165
|
**returns**: the unsubscribing function
|
|
167
166
|
|
package/dist/index.js
CHANGED