Skip to content

Commit 8d0b393

Browse files
authored
docs(readme): add "Use with Redux" part (#137)
Closes #136
1 parent eeeb71e commit 8d0b393

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ This piece of code is an assertion, an error will be thrown if something goes wr
4040
npm install --save handle-io
4141
```
4242

43+
------
44+
4345
### IO
4446

4547
io is just a wrapper for functions and arguments.
@@ -82,6 +84,8 @@ log.run();
8284

8385
The idea of this library is to apply an **IO** function inside a structure called **handler**.
8486

87+
------
88+
8589
### Handlers
8690
A **handler** is a wrapped pure [generator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator) which just apply some **IO** function and/or **handler**.
8791

@@ -142,6 +146,8 @@ Likewise, don't use handlers' **.run()** everywhere in your codebase.
142146

143147
**handlers** are combinable together: **you can yield a handler**.
144148

149+
------
150+
145151
### Promise support
146152

147153
`handle-io` supports promises and allows you to create asynchronous IO.
@@ -177,6 +183,8 @@ sleepSecond(1).run().then((n) => {
177183
});
178184
```
179185

186+
------
187+
180188
### Dealing with errors
181189

182190
#### using Try/Catch
@@ -268,6 +276,8 @@ testHandler(myHandler())
268276
.run();
269277
```
270278

279+
------
280+
271281
### Custom testHandler
272282

273283
A custom `testHandler` can be created using `createTestHandler`.
@@ -307,5 +317,14 @@ customTestHandler(myHandler('hello world'))
307317
.run()
308318
```
309319
320+
------
321+
322+
## Use with [Redux](https://redux.js.org)
323+
324+
There is a way to use `handler` as [redux middleware](https://redux.js.org/advanced/middleware).
325+
326+
Please take a look to [redux-fun Handlers](https://github.com/guillaumearm/redux-fun#handlers).
327+
328+
310329
## License
311330
[MIT](https://github.com/guillaumearm/handle-io/blob/master/LICENSE)

0 commit comments

Comments
 (0)