Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/4.0.6/rx.all.js"></script>
  <script src="https://rawgit.com/cyclejs/cycle-core/v6.0.0/dist/cycle.js"></script>
  <script src="https://rawgit.com/cyclejs/cycle-dom/v9.0.1/dist/cycle-dom.js"></script>
  </head>
<body>
<div id="app">
</div>
</body>
</html>
 
const {h, h1, span, makeDOMDriver} = CycleDOM;
function main(sources) {
  const hover$ = sources.DOM.select('span').events('mouseover');
  return {
    DOM: hover$
      .startWith(null)
      .flatMapLatest(() =>
        Rx.Observable.timer(0, 1000)
          .map(i => h1({style: {background: 'red'}}, [span([`Seconds Elapsed ${i}`])]))
      ),
    Log: Rx.Observable.timer(0, 2000)
      .map(i => 2 * i)
  };
}
function consoleLogDriver(msg$) {
  msg$.subscribe(msg => {
    console.log(msg);
  });
}
const drivers = {
  DOM: makeDOMDriver('#app'),
  Log: consoleLogDriver
};
Cycle.run(main, drivers);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
yoyoyohamapipro
0viewers