Last active
August 18, 2018 01:22
-
-
Save humanchimp/33d2b7683e4d2f52fdc38ed8fd1f1c01 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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