Skip to content

Instantly share code, notes, and snippets.

@nverinaud
Last active December 31, 2015 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nverinaud/7942279 to your computer and use it in GitHub Desktop.
Save nverinaud/7942279 to your computer and use it in GitHub Desktop.
Diff between event-driven and FRP.
// 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