簡単な解決策は、サブジェクトを使用することです。
render() {
return (
<div onWheel={e => this.onWheel$.next(e)}>
{children}
</div>
);
}
componentWillMount() {
this.onWheel$ = new Rx.Subject();
this.onWheel$.throttleTime(500).subscribe(this.onWheel);
}
componentWillUnmount() {
this.onWheel$.unsubscribe();
}
onWheel(event) {...}
実用的な例については、このjsfiddleを参照してください。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加