Rxjs基本概念

本文介绍了Rxjs中的核心概念,包括Observable(可观察对象)、Observer(观察者)和Subscription(订阅)。Observable是一种延迟推送多个值的集合,Observer是接收这些值的回调集合,而Subscription代表执行过程并可用于取消订阅。文章通过对比Pull和Push系统,解释了Observable与传统函数、生成器和Promise的区别,并展示了如何创建和订阅Observable。
摘要由CSDN通过智能技术生成

1. Rxjs中的对象及概念

  • Observable: represents the idea of an invokable collection of future values or events.
  • Observer: is a collection of callbacks that knows how to listen to values delivered by the Observable.
  • Subscription: represents the execution of an Observable, is primarily useful for cancelling the execution.
  • Operators: are pure functions that enable a functional programming style of dealing with collections with operations like mapfilterconcatreduce, etc.
  • Subject: is equivalent to an EventEmitter, and the only way of multicasting a value or event to multiple Observers.
  • Schedulers: are centralized dispatchers to control concurrency, allowing us to coordinate when computation happens on e.g. setTimeout or requestAnimationFrame or others.

2. what is observable?

Observables are lazy Push collections of multiple values. They fill the missing spot in the following table:

SINGLE MULTIPLE
Pull
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值