我如何使用`do`作为RxJS可调运算符? [英] How would I use `do` as an RxJS lettable operator?

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

问题描述

RxJS 5.5允许抓取lettable运算符并像这样管道:

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 执行关键字相撞。

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天全站免登陆