Angular5 中的 RxJs v5 - clickStream.bufer( () => clickStream.throttleTime(250)) 等失败
RxJs v5 in Angular5 - clickStream.bufer( () => clickStream.throttleTime(250)) etc fails
我怎样才能做到以下几点?
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; });
错误信息是:
TS2345: argument of type '()=> void' is not assignable to paramter of
type Observabl. Property '_isScalar' is missing in type ()=>void
".buffer(function() { return clickStream.throttleTime(250); })
"
之类的替代方法会产生类似的错误。
我也试过throttle(250)
,但还是不行。
您似乎想使用接受函数作为参数的 bufferWhen
。
否则直接将 Observable 传递给 buffer
而不包装它:
...
.buffer(clickStream.throttleTime(250))
我怎样才能做到以下几点?
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; });
错误信息是:
TS2345: argument of type '()=> void' is not assignable to paramter of type Observabl. Property '_isScalar' is missing in type ()=>void
".buffer(function() { return clickStream.throttleTime(250); })
"
之类的替代方法会产生类似的错误。
我也试过throttle(250)
,但还是不行。
您似乎想使用接受函数作为参数的 bufferWhen
。
否则直接将 Observable 传递给 buffer
而不包装它:
...
.buffer(clickStream.throttleTime(250))