官术网_书友最值得收藏!

Reacting for the First Time

In the previous chapter, you started understanding the motivations behind using functional reactive programming in your systems; you also saw how a program using this paradigm fared against a program without it. You learned how reactive programming can improve code readability and testability by decoupling your event sources from the action you take when the action occurs.

We started with some basic examples using bacon.js as the reactive programming library for JavaScript. In the examples, we began with creating our first EventStream from an interval. Then we started using some operators (map() and take()). Finally, we subscribed to this event source to take actions in the case of an event occurrence. This was just a kind introduction to functional reactive programming.

When reading most of the functional reactive programming libraries (for any language), you will see a lot of diagrams explaining how the operator works. In the previous chapter, I presented the following diagram to illustrate a filter function:

We will cover what this illustration means in detail in this chapter. Learning how to read this will make reading documentation on libraries a lot easier.

Functional reactive programming is a paradigm which is hard to master, so after the quick introduction, you'll now move on to learning how to implement more complex programs using the bacon.js library.

This chapter will cover the following points:

  • Understanding bacon.js observable objects (EventStream and Property) and their differences
  • Modeling a functional reactive program
  • Subscribing to an observable
  • Unsubscribing from an observable
  • Reading a reactive programming operator diagram
  • Using operators to transform an observable
主站蜘蛛池模板: 胶南市| 西盟| 灵武市| 江阴市| 麟游县| 班戈县| 即墨市| 石首市| 洪江市| 偏关县| 日喀则市| 都昌县| 石门县| 双峰县| 平舆县| 额济纳旗| 龙陵县| 武鸣县| 西畴县| 宣汉县| 玛沁县| 建水县| 荃湾区| 叙永县| 漯河市| 鄂伦春自治旗| 嵊泗县| 通河县| 根河市| 同心县| 安福县| 军事| 巴塘县| 贵南县| 望江县| 齐齐哈尔市| 剑川县| 乌海市| 浏阳市| 社会| 永春县|