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

A minimal CES framework

Before we get started on the details, we should define what minimal means.

Let's start with the two main abstractions our framework will provide: behaviors and event streams.

If you can recall from Chapter 1, What is Reactive Programming?, behaviors represent continuous, time-varying values such as time or mouse position behavior. Event streams, on the other hand, represent discrete occurrences at a point in time, T, such as a key press.

Next, we should think about what kinds of operations we would like to support. Behaviors are fairly simple, so at the very least we need to do the following:

  1. Create new behaviors
  2. Retrieve the current value of a behavior
  3. Convert a behavior into an event stream

Event streams have more interesting logic at play and we should at least support these operations:

  • Push/deliver a value down the stream
  • Create a stream from a given interval
  • Transform the stream with the map and filter operations
  • Combine streams with flatmap
  • Subscribe to a stream

This is a small subset, but big enough to demonstrate the overall architecture of a CES framework. Once we're done, we'll use it to build a simple example.

主站蜘蛛池模板: 旺苍县| 屏南县| 泽州县| 金川县| 万全县| 荆州市| 德清县| 牡丹江市| 淄博市| 勃利县| 松阳县| 隆尧县| 朝阳区| 石景山区| 仁化县| 花莲县| 长垣县| 砚山县| 北辰区| 宁阳县| 竹北市| 辽中县| 永年县| 清徐县| 铁岭县| 彭泽县| 永丰县| 平阴县| 阿鲁科尔沁旗| 武鸣县| 铁力市| 保山市| 永平县| 珠海市| 义乌市| 诸暨市| 湾仔区| 丰原市| 金塔县| 西华县| 新巴尔虎右旗|