Bacon.js is an FRP module for events on javascript. Which can transform
your event listener/handler to a functional event stream. After servey a few blogs and example project,
I found it is a really interesting concept and can make event handling speghetti code into clear functional logics.
Event stream
First, what is event stream?
Actually it is nothing special, it is just an event listener that listen to specific event.
For example,
$("#clickme").on('click', function(event){ alert(event.target)})
Can transfer to event stream by Bacon.js’s asEventStream helper:
clicked = $("#clickme").asEventStream('click')
And add handler to event stream, listen to click event:
clicked.onValue(function(event){ alert(event.target) })
Read More...