File tree 2 files changed +41
-1
lines changed
2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -53,4 +53,32 @@ let increment = store => {
53
53
}
54
54
55
55
export const store = createStore ([increment, createEpicMiddleware (epics)]);
56
- ```
56
+ ```
57
+
58
+ Using TypeScript you can assign ` Epic ` interface to the function to specify ` action ` and ` state ` typing
59
+
60
+ #### ` epic.ts `
61
+ ``` typescript
62
+ import { combineEpics , ofEvent , Epic } from ' storeon-observable' ;
63
+ import { mapTo , delay } from ' rxjs/operators'
64
+
65
+ interface State {
66
+ isPinging: boolean ;
67
+ }
68
+
69
+ const epic: Epic <State > = (action$ , state$ ) => action$ .pipe (
70
+ ofEvent (' ping' ),
71
+ delay (1000 ),
72
+ mapTo (' pong' ),
73
+ );
74
+
75
+ export const epics = combineEpics ([epic ]);
76
+ ```
77
+
78
+ ## Acknowledgments
79
+
80
+ This module based on [ redux-observable] ( https://github.com/redux-observable/redux-observable ) .
81
+
82
+ ## LICENSE
83
+
84
+ [ MIT] ( LICENCE )
Original file line number Diff line number Diff line change
1
+ import { Store } from 'storeon' ;
2
+ import { Observable } from 'rxjs' ;
3
+
4
+ export declare interface Epic < State = unknown > {
5
+ ( action$ : Observable < string > , state$ : Observable < State > ) : Observable < string > ;
6
+ }
7
+
8
+ export declare function createEpicMiddleware ( rootEpic : Epic ) : ( store : Store ) => void ;
9
+
10
+ export declare function combineEpics ( epics : Epic [ ] ) : Epic ;
11
+
12
+ export declare function ofEvent ( key : string ) : ( source : Observable < string > ) => Observable < string > ;
You can’t perform that action at this time.
0 commit comments