March 2017
Intermediate to advanced
821 pages
18h 21m
English
In programming, lazy evaluation is a strategy that delays the evaluation of values until they're needed. There are two means by which lazy evaluation is implemented by Bacon.js.
A stream or property will not be attached to its data source until it has subscribers. Let's look at an example to understand this. Place this code in the index.js file:
var myButton_click_stream1 = $("#myButton").asEventStream("click").map(function(event){
console.log(event);
return event;
});Here, when you click on the myButton button, nothing will be logged. Now, place this code in the index.js file:
myButton_click_stream1.onValue(function(event){})Now when you click on the button, the event will be logged.
The log method is also considered as a subscriber. ...
Read now
Unlock full access