Assorted notes from learning and experimenting with Fulcro.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defrecord Server [service-map] | |
component/Lifecycle | |
(start [component] | |
(info :msg "Starting server.") | |
(let [server (bootstrap/create-server (:service-map service-map))] | |
(bootstrap/start server) | |
(assoc component :server server))) | |
(stop [component] | |
(info :msg "Stopping server.") | |
(update-in component [:server] bootstrap/stop))) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.