我将如何使用 `do` 作为 RxJS 的可出租操作符? [英] How would I use `do` as an RxJS lettable operator?

查看:21
本文介绍了我将如何使用 `do` 作为 RxJS 的可出租操作符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

RxJS 5.5 允许抓取可出租的操作符并像这样进行管道传输:

RxJS 5.5 allows grabbing lettable operators and piping them like so:

import { ajax } from 'rxjs/observable/dom/ajax'
import { catchError, map, retry } from 'rxjs/operators'

ajax.getJSON('https://example.com/api/test')
.pipe(
    retry(3, 1000),
    map(fetchUserFulfilled),
    catchError(console.error)
)

如何在这些命令之间使用 do 运算符?

How would I use the do operator between these commands?

推荐答案

do 操作符在 RxJS 5.5 中被重命名为 tap 因为它与 JavaScript 发生冲突do 关键字.

The do operator was renamed in RxJS 5.5 to tap because it collided with the JavaScript do keyword.

有关更多信息,请参阅:https://github.com/ReactiveX/rxjs/blob/master/doc/pipeable-operators.md#pipeable-operators

For more info see: https://github.com/ReactiveX/rxjs/blob/master/doc/pipeable-operators.md#pipeable-operators

这篇关于我将如何使用 `do` 作为 RxJS 的可出租操作符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆