Get started with reactive-coffee CDN

MIT licensed

Reactive-coffee is a library for implementing reactive programming using CoffeeScript syntax.

Tags:
  • reactive
  • reactive-programming
  • dataflow
  • mvc
  • mvvm
  • model-view
  • binding
  • data-binding
  • view

Stable version

Copied!

How to start using reactive-coffee CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with reactive-coffee CDN - cdnhub.io</title>
  <script src="https://cdn.jsdelivr.net/npm/rxjs@7.3.0/rxjs.min.js"></script>
  <script src="https://cdn.cdnhub.io/reactive-coffee/2.3.1/main.min.js"></script>
</head>
<body>
  <button id="button">Click me</button>
  <p id="counter">0</p>

  <script>
    const Rx = require('rxjs');

    const button$ = Rx.fromEvent(document.getElementById('button'), 'click');
    const counter$ = button$.pipe(
      Rx.map(() => parseInt(document.getElementById('counter').innerText, 10)),
      Rx.map(n => n + 1),
      Rx.map(n => document.getElementById('counter').innerText = n)
    );

    const subscription = Rx.merge(button$, counter$).subscribe();
  </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!

All versions