分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 前端开发

RxJS Observable - switch && switchMap

发布时间:2023-09-06 01:33责任编辑:董明明关键词:暂无标签
  1. "switch" subscribes to an Observable that emits Observables, also known as a higher-order Observable.
    解释: “ that emits Observables” 作为前面 “an Observable” 的修饰从句。

  2. Each time it observes one of these emitted inner Observables,
    the output Observable subscribes to the inner Observable and begins emitting the items emitted by that.
    解释: “the output Observable subscribes to the inner Observable and begins emitting the items emitted by that.” 补全的写法应该是:
    “the output Observable subscribes to the inner Observable and (the output) begins emitting the items emitted by (the inner Observable).” 去掉的“that”其实就是“the inner Observable”

  3. Returns an Observable that emits items based on applying a function that you supply to each item emitted by the source Observable, where that function returns an (so-called "inner") Observable.
    分三个阶段来看:
    第一阶段:Returns an Observable that (1. blah, blah, blah....) ;
    解释: 返回一个Observable
    第二阶段:Returns an Observable that emits items (2. blah, blah, blah....) emitted by the source Observable
    解释:返回一个会emits items的Observable。
    这些 items 是 emited 自 the source Observable 的。
    (说明是两层Observable, 即 higher-order Observable)
    第三阶段:(2. blah, blah, blah....) 所指代的那一段:based on applying a function that you supply to each item
    解释:第二阶段中 每个 item 都是由你所提供的(自定义) function 加工过的

RxJS Observable - switch && switchMap

原文地址:https://www.cnblogs.com/skating/p/8167997.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved