March 2017
Intermediate to advanced
821 pages
18h 21m
English
Bacon also provides us ways to create constant properties. Constant properties are initialized at the time of creation and cannot be reinitialized, that is, new values cannot be pushed.
A constant property is created using the Bacon.constant() constructer. We need to pass the value of the property to the constructor. A constant property can be merged, concatenated, combined, zipped, sampled, filtered, and transformed.
Here is an example of how to create a constant property. Place this code in the index.js file:
var script_start_time = Bacon.constant(Date.now()).map(function(value){ var date = new Date(value); return (date).getHours() + ":" + (date).getMinutes() + ":" + (date).getSeconds(); }); script_start_time.onValue(function(value){ ...Read now
Unlock full access