Skip to content

Instantly share code, notes, and snippets.

@aaronmcadam
Created May 9, 2017 14:07
Show Gist options
  • Save aaronmcadam/11b7771c31e4c71af96e0be4e85f8e30 to your computer and use it in GitHub Desktop.
Save aaronmcadam/11b7771c31e4c71af96e0be4e85f8e30 to your computer and use it in GitHub Desktop.
export function App (sources) {
const request$ = xs.periodic(3000)
.mapTo({
url: 'http://localhost:3000',
category: 'api',
});
const vtree$ = sources.HTTP.select('api')
.flatten()
.map(res => res.body)
.startWith({
name: 'Loading...'
})
.map(result =>
div([
h2('.label', `Name ${result.name}`)
])
);
const sinks = {
DOM: vtree$,
HTTP: request$,
}
return sinks;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment