FRP using Bacon.js
Bacon.js is a JavaScript library that helps us write functional reactive code in JavaScript. It can be used for both frontend and backend JavaScript. The official website of Bacon.js library is https://baconjs.github.io/.
Let's create a basic website project to demonstrate FRP with Bacon.js.
Setting up the project
Let's learn how to download and install Bacon.js for use with frontend and backend JavaScript. On the frontend, Bacon.js depends on jQuery.
Create a directory named baconjs-example
. Inside it, create files called package.json
and app.js
and a directory called public
. Inside the public
directory, create directories called html
and js
. Inside the html
directory, create a file called index.html
. Finally, inside the js
directory, create a file called index.js
.
Download the frontend Bacon.js library from http://cdnjs.cloudflare.com/ajax/libs/bacon.js/0.7.73/Bacon.js and jQuery from https://code.jquery.com/jquery-2.2.0.min.js, and place them in the js
directory.
At the...