在这段代码中,为什么在我设置subject.sample(500)但setTimeout(200)时首先打印subject.onNext(3)?
const Rx = require('rx');
const subject = new Rx.Subject();
const sampleObservable = subject.sample(500);
sampleObservable.subscribe(
data => console.log(data),
error => console.log(error),
() => console.log('FINISHED')
);
subject.onNext(0);
subject.onNext(1);
setTimeout(() => {
subject.onNext(2);
subject.onNext(3);
subject.onCompleted();
}, 200);