-
-
Save Struchu/460317885848194760650ba928996ea7 to your computer and use it in GitHub Desktop.
Reactive Coordinators proof of concept
This file contains 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
import { fromEventPattern } from 'rxjs'; | |
import authCoordinator from './authCoordinator'; | |
export default function (screen, connector) { | |
// The 'q' key will quit the application no matter where the user is. | |
const dispose = fromEventPattern( | |
h => { screen.key('q', h); }, | |
h => { screen.unkey('q', h); }, | |
); | |
// The 'screen' and 'connector' are also injected in the child coordinator. | |
authCoordinator(screen, connector).subscribe( | |
token => { | |
/* | |
Do something with a token, ie. | |
pass control to the dashboard coordinator. | |
*/ | |
}, | |
); | |
return dispose; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment