【问题标题】:What happened to the rxjs "join" operator?rxjs "join" 操作符怎么了?
【发布时间】:2018-06-20 01:19:27
【问题描述】:

reactivex.io 文档中,有一个称为 join 的运算符: http://reactivex.io/documentation/operators/join.html

这个操作员后来怎么样了?看起来这可能在 RxJS 5 中被删除了?我能做些什么来代替它?

在我的 Angular/TypeScript 应用程序中,当我尝试在 Observable 上调用 .join() 时出现编译器错误。

我尝试过手动导入,但是 NPM 模块中没有“rxjs/add/observable/join”。即使我放入 TypeScript 模块声明以使编译器满意,我仍然会在运行时收到错误。

【问题讨论】:

标签: angular typescript rxjs reactivex


【解决方案1】:

如果您使用带间隔的连接运算符,则可以将其替换为

observableA.timestamp().
      combineLatest(observableB.timestamp(),
      (a, a) => {return {a, b})
.filter(({a, b}) => { return Math.abs(a.timestamp - b.timestamp) < 1000})

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-11-06
    • 2021-12-01
    • 1970-01-01
    • 2018-04-01
    • 2021-04-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多