Skip to content

Instantly share code, notes, and snippets.

@nickbalestra
Last active December 19, 2016 22:45
Show Gist options
  • Select an option

  • Save nickbalestra/2ad4c764ae1e975849937f1c3de84b1f to your computer and use it in GitHub Desktop.

Select an option

Save nickbalestra/2ad4c764ae1e975849937f1c3de84b1f to your computer and use it in GitHub Desktop.
Creates stream of states from a Redux store
import xs from 'xstream'
function streamFromStore(store) {
return xs.create(
{
start: function(listener){
this.unsubscribe = store.subscribe(() => listener.next(store.getState()))
},
stop: function(){
this.unsubscribe()
}
}
).startWith(store.getState())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment