DEV Community

loading...

Flyd a functional reactive library...

artydev profile image artydev ・1 min read

In my previous post I said Kefir is lighter than RxJS.

Flyd is lighter than Kefir, perhaps will it fits your needs.

Here is a simple counter in Flyd : FlydCounter

var clicks = flyd.stream();

inc.addEventListener('click', () => clicks(1));
dec.addEventListener('click', () => clicks(-1));

const sum = flyd.scan((x,y) => x + y, 0, clicks)

sum.map((v) => result.innerText = v)
Enter fullscreen mode Exit fullscreen mode

Discussion (0)

pic
Editor guide