RxJS管道方法忽略流的objectMode

时间:2015-12-15 16:39:43

标签: node.js reactive-programming rxjs

有一种名为pipe的方法。请考虑下面的代码:

class S extends stream.Transform {
    constructor () {
      super({objectMode: true})
    }
    _transform (data, enc, cb) {
      console.log('vm', data, enc)
      this.push(null, data)
      cb()
    }
 }
var s = new S()
factors // just a stream of some objects
  .do((x) => console.log(x)) // I see an object here
  .pipe(s) // but here the object casts to string

如何强制Rx不要忽略objectMode

0 个答案:

没有答案