debounce is a pretty cool operator in Rx. When you want to emit an item only after a certain amount of time has passed,
debounce does that in a pretty simple way:
Now that you have solved your problem with
debounce, it’s time to write a small test and set it in stone.
^R to run the test and 💥
Looks like our sweet little
debounce operator runs on its own sweet little scheduler and our
TestScheduler wasn’t able to override it. Only took an entire day to figure that out! 🤦
Pass a scheduler to
and use the
TestScheduler to test.
^R to run the test and ʕ•ᴥ•ʔ
If you liked this post, share it and stay tuned for the next one!
Read other stuff I’ve written here.