Last active
December 31, 2015 05:39
-
-
Save nverinaud/7942279 to your computer and use it in GitHub Desktop.
Diff between event-driven and FRP.
This file contains hidden or 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
// event driven | |
loadArticle(function (article) { | |
myTextField.text = article.title; | |
if (article.title == "toto") | |
alert("Toto arrived"); | |
}); | |
// FRP | |
var article = loadArticle(); | |
article.whenAnyValue('title').bindTo(myTextField.text); | |
article.where(function (theArticle) { | |
return article.title == "toto"; | |
}).subscribe(function (theArticle) { | |
alert("Toto arrived !"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment