我想实现的功能是当用户有输入动作时开始计数,下次输入时离上次输出时间超过3秒停止计数并执行subscribe里的逻辑
Rx.Observable.fromEvent(input,"input")
.startWith(0)
.throttle(e=>Rx.Observable.interval(3000))
.subscribe(e=>console.log(e))
求问Rxjs中如何在不定义一个外部变量的情况下实现计数。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
Rx.Observable.fromEvent(input, 'input')
.throttleTime(3000)
.scan(count => count + 1, 0)
.subscribe(count => console.log(
${count}));http://stackoverflow.com/ques...