0
私は多くのグーグルグーグルで、d.tsファイルを見ようとしましたが、何が間違っているのかまだ分かりません。この機能の使い方をRxJs5の例で見つけることはできません。RxJS 5バッファ機能の使い方は?
var source = Observable.fromEvent(document.body, 'keypress');
var delayedSource = source.delay(1000);
var obs = source
.buffer(() => {
return delayedSource;
})
.map((clickBuffer) => {
return clickBuffer.length;
});
私が取得していますエラー:
エラー:(166、15)TS2345:型の引数 '()=>観測< {}>' '観測' タイプのパラメータに割り当て可能ではありません。 プロパティ '_isScalar'が型 '()=> Observable < {}>'にありません。
buffer.d.tsこれを見て、私はこれから理解する必要がありますが、私はできません。
import { Observable } from '../Observable';
/**
* Buffers the incoming observable values until the passed `closingNotifier`
* emits a value, at which point it emits the buffer on the returned observable
* and starts a new buffer internally, awaiting the next time `closingNotifier`
* emits.
*
* <img src="./img/buffer.png" width="100%">
*
* @param {Observable<any>} closingNotifier an Observable that signals the
* buffer to be emitted} from the returned observable.
* @returns {Observable<T[]>} an Observable of buffers, which are arrays of
* values.
*/
export declare function buffer<T>(closingNotifier: Observable<any>): Observable<T[]>;
export interface BufferSignature<T> {
(closingNotifier: Observable<any>): Observable<T[]>;
}
この質問はここから来た:ベンジャミンGruenbaumのコメントに基づいて Counting keypresses per second with angular 2 Rxjs
あなたがで関数を渡しているが、あなたは、観察を渡すべきです。 –