Angular5中的RxJs v5-clickStream.bufer(()=> clickStream.throttleTime(250))等失败

时间:2018-11-29 17:18:59

标签: angular rxjs rxjs5

我该怎么做?

=IFERROR(SUM(IFERROR(SUMIF(OFFSET('96-1A'!$M$1,$B3,MATCH(I$2,d_961a,0),1,1),">=0"),0),IFERROR(SUMIF(OFFSET('96-2A'!$M$1,$B3,MATCH(I$2,d_962a,0),1,1),">=0"),0),IFERROR(SUMIF(OFFSET('96-3A'!$M$1,$B3,MATCH(I$2,d_963a,0),1,1),">=0"),0),IFERROR(SUMIF(OFFSET('96-4A'!$M$1,$B3,MATCH(I$2,d_964a,0),1,1),">=0"),0))/SUM(IFERROR(COUNTIF(OFFSET('96-1A'!$M$1,$B3,MATCH(I$2,d_961a,0),1,1),">=0"),0),IFERROR(COUNTIF(OFFSET('96-2A'!$M$1,$B3,MATCH(I$2,d_962a,0),1,1),">=0"),0),IFERROR(COUNTIF(OFFSET('96-3A'!$M$1,$B3,MATCH(I$2,d_963a,0),1,1),">=0"),0),IFERROR(COUNTIF(OFFSET('96-4A'!$M$1,$B3,MATCH(I$2,d_964a,0),1,1),">=0"),0)),"--")

错误消息是:

  

TS2345:类型'()=> void'的参数不能分配给   键入Observabl。类型()=> void

中缺少属性'_isScalar'

诸如let button = document.querySelector('.this'); let clickStream = Observable.fromEvent(button, 'click'); let multiClickStream = clickStream .buffer(() => { return clickStream.throttleTime(250); } ) .map(function(list) { return list.length; }) .filter(function(x) { return x >= 2; }); 之类的替代方法也给出类似的错误。

我也尝试了".buffer(function() { return clickStream.throttleTime(250); }) ",但这都不起作用。

1 个答案:

答案 0 :(得分:2)

您似乎想使用接受函数作为参数的bufferWhen

否则,只需将Observable直接传递给buffer而不包装它即可:

...
.buffer(clickStream.throttleTime(250))