react-kefir example

HTML

<script src="https://npmcdn.com/kefir@3.2.0"></script>
<script src="https://npmcdn.com/react-dom@0.14.7/dist/react-dom.js"></script>
<script src="https://npmcdn.com/react-kefir@0.2.1"></script>

Babel + JSX

function f(x) {
	if (x % 2 === 0) {
		throw Error();
  } else {
    return x;
  }
}
const stream = Kefir.sequentially(1000, [1, 2, 3]);
const mapped = stream.flatMap(function (value) {
  try { return Kefir.constant(f(value)); }
  catch (error) { return Kefir.constantError(error); }
});
mapped.log();