Link Details

Link 965583 thumbnail
User 1059807 avatar

By acoin
via dzone.com
Published: May 07 2013 / 12:12

Bacon.js is FRP / Functional Reactive Programming library for JavaScript. Solve real world JavaScript problems in UI development.
  • 6
  • 0
  • 873
  • 922

Comments

Add your comment
User 166389 avatar

dxxvi replied ago:

1 votes Vote down Vote up Reply

Let me summarize what I understand about bacon.js through the posted article: Suppose that we have 2 text boxes and a button. The 'disabled' property of this button depends on the values in the 2 text boxes. Bacon.js allows us to implement that in a few lines like this: function requirementForTextBoxes(textBoxValue) { /* return true or false based on the textBoxValue */ } var textBox1ValueSatisfied = Bacon.UI.textFieldValue($("#textBox1")).map(requirementForTextBoxes); var textBox2ValueSatisfied = Bacon.UI.textFieldValue($("#textBox2")).map(requirementForTextBoxes); var buttonEnabled = textBox1ValueSatisfied.and(textBox2ValueSatisfied); buttonEnabled.not().assign($("#button"), "attr", "disabled"); In my opinion, it's not easy to understand as in angularjs or knockoutjs. In those frameworks, we map the textbox1 value to a javascript variable, say textBox1Value; then we map the textbox2 value to a javascript variable, say textBox2Value. Then each framework allows us to specify a clean, easy-to-understand (IMO) mapping between the 'disabled' property of the button and textBoxValues.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (6)



Voters Against This Link (0)



    Play Framework
    Written by: Ryan Knight
    Featured Refcardz: Top Refcardz:
    1. Akka
    2. Design Patterns
    3. OO JS
    4. Cont. Delivery
    5. HTML5 Mobile
    1. Akka
    2. JUnit/EasyMock
    3. Java Performance
    4. REST
    5. Java