Skip to content

Instantly share code, notes, and snippets.

@humanchimp
Last active August 18, 2018 01:22
Show Gist options
  • Save humanchimp/33d2b7683e4d2f52fdc38ed8fd1f1c01 to your computer and use it in GitHub Desktop.
Save humanchimp/33d2b7683e4d2f52fdc38ed8fd1f1c01 to your computer and use it in GitHub Desktop.
import xs from 'xstream'
import {Sources, Sinks} from './interfaces'
const intent = (sources$: Sources) => sources$.DOM
.select('button')
.events('click')
.map(ev => 1);
const model = (intent$: any) => intent$
.fold((total, change) => total + change, 1);
const view = (model$: any) => model$.map(count =>
<div>
<h1>Hyperfactorials</h1>
<p>
The <strong>{ordinalSuffix(Number(count))}</strong> hyperfactorial is <strong>{String(hyperfactorial(count))}</strong>
</p>
<div>Click <button>here</button> to see the next hyperfactorial</div>
</div>
)
export function App(sources: Sources): Sinks {
return {
DOM: view(model(intent(sources)))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment