This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const connectToServerEpic = ( | |
| action$, | |
| ) => ( | |
| action$ | |
| .pipe( | |
| ofType(CONNECT_TO_SERVER), | |
| switchMap(({ | |
| hostname, | |
| port, | |
| protocol, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const connectToWebSocketServiceEpic = ( | |
| action$, | |
| ) => ( | |
| action$ | |
| .pipe( | |
| ofType(APP_STARTED), | |
| map( | |
| connectToServer({ | |
| hostname: 'example.com', | |
| port: 3000, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| connectToServer({ | |
| hostname: 'example.com', | |
| port: 3000, | |
| protocol: 'ws', | |
| protocolVersion: 'v1', | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| startWith( | |
| setLoading( | |
| 'login', | |
| ), | |
| userState({ | |
| state: userStates.PENDING, | |
| username, | |
| }), | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fetchUserEpic = ( | |
| action$, | |
| ) => ( | |
| action$ | |
| .pipe( | |
| ofType(FETCH_USER), | |
| switchMap(({ | |
| password, | |
| username, | |
| }) => ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fetchUserEpic = ( | |
| action$, | |
| state$, | |
| { dispatch }, | |
| ) => ( | |
| action$ | |
| .pipe( | |
| ofType(FETCH_USER), | |
| tap(() => { | |
| dispatch( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fetchUserEpic = ( | |
| action$, | |
| ) => ( | |
| action$ | |
| .pipe( | |
| ofType(FETCH_USER), | |
| switchMap(({ | |
| password, | |
| username, | |
| }) => ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function instance($$self, $$props, $$invalidate) { | |
| let count = 0 | |
| const stateModifiers = { | |
| DECREMENT: () => { | |
| $$invalidate('count', count -= 1) | |
| }, | |
| INCREMENT: () => { | |
| $$invalidate('count', count += 1) | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const epic$ = ( | |
| new BehaviorSubject( | |
| rootEpic | |
| .pipe( | |
| switchMap(( | |
| value, | |
| ) => ( | |
| typeof value === 'object' | |
| && value.type | |
| ? of(value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const someEpic = ({ | |
| action$, | |
| dispatch, | |
| }) => ( | |
| // ... | |
| ) |