The best way to get acquainted with event loop is through a popular library in the JavaScript world, that is, jQuery.
If you have experience working with jQuery, you can simply create (or chain) events to a simple DOM selector and then write code to handle those specific events. For example, you could create an onClick
event by attaching it to a specific link and then code what will happen when that link is clicked.
If you're familiar with jQuery, the code to control a link that has the ID someLink
would look something like the following:
HTML:
< a href="some url" id="someLink">
JavaScript:
$("#someLink").on('click', function() { //some code here });
In the preceding code snippet, every time jQuery finds an element with an ID of someLink
, it will do something on each click event.
As it is in an event loop, it will loop over each iteration of the event loop and work on what needs to be done.
However, it is a little bit different in Reactive Programming...