But after the execution of the above code, only 45 should be printed out and it does too, because whenever we assign a new value to listenable.value it will be overriding the old value after the debounce time is ended. If we want to print all values, in this example 42, 43, 44, 45, and 46, we need to await for >= debounce time which is (500 in this case) after each assignment. So the code will be like
Thanks for pointing this out, but in this case the documentation was wrong. Strange that I didn't saw that because I ran the tests.
it really only should return '45'
Example code from the doc and test
But after the execution of the above code, only
45
should be printed out and it does too, because whenever we assign a new value tolistenable.value
it will be overriding the old value after the debounce time is ended. If we want to print all values, in this example 42, 43, 44, 45, and 46, we need to await for>=
debounce time which is (500 in this case) after each assignment. So the code will be like