Skip to content

Instantly share code, notes, and snippets.

@TheSeamau5
Last active Sep 20, 2016
Embed
What would you like to do?
Runner Generator (useful to generate different runners depending on the platform)
// makeRunner : (renderer : ReactComponent -> ())
// -> (update : s -> a -> s, render : s -> Dispatcher a -> ReactComponent, observable : Observable a)
// -> ()
export const makeRunner = (renderer) => (update, render, observable) => {
const store = createStore(update);
const renderApp = () => renderer(render(store.getState(), store.dispatch));
renderApp();
if (observable) {
observable.subscribe(store.dispatch);
}
store.subscribe(renderApp);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment