Link Details

Link 965583 thumbnail
User 1059807 avatar

By acoin
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
  • 910
  • 922
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.

Upvoters (6)

Downvoters (0)

    Apache Hadoop
    Written by: Piotr Krewski
    Featured Refcardz: Top Refcardz:
    1. Play
    2. Akka
    3. Design Patterns
    4. OO JS
    5. Cont. Delivery
    1. Play
    2. Java Performance
    3. Akka
    4. REST
    5. Java