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

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.

主站蜘蛛池模板: 金阳县| 阿拉善左旗| 贵阳市| 夏河县| 泾川县| 晋中市| 探索| 喜德县| 临夏县| 敦煌市| 资阳市| 通渭县| 时尚| 遵义市| 于都县| 抚顺县| 和静县| 中牟县| 青龙| 德江县| 成安县| 纳雍县| 通州市| 金门县| 宜兰市| 华容县| 育儿| 依兰县| 乌什县| 玉溪市| 临漳县| 克山县| 桂阳县| 两当县| 育儿| 公主岭市| 乳山市| 孝感市| 怀安县| 新平| 灌南县|