debounceTime config with { leading: true } #7449
EugeneHerasymchuk
started this conversation in
Ideas / Feature request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In current behaviour, throttleTime has configuration (default is
{ leading:true}
at the moment) allowing to emit first event immediately and last event, throttling for N time the others.Proposition:
would it be reasonable to add similar config for debounceTime. Theoretically, the default is already
{ trailing: true }
- we receive the most recent event at the end of debounce time.With
{ leading: true}
the expected behaviour would be - we receive the first item after "the last item of the debounce subscription + debounce timeout".This would allow to have marble diagram that I provided at the end. 'A' was the first value and it will emit only on 800ms
throttleTime:
![image](https://private-user-images.githubusercontent.com/16426867/308864298-1bfce2ef-2132-4be5-8cb0-be6b900ede6e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk3NDYyNzQsIm5iZiI6MTcxOTc0NTk3NCwicGF0aCI6Ii8xNjQyNjg2Ny8zMDg4NjQyOTgtMWJmY2UyZWYtMjEzMi00YmU1LThjYjAtYmU2YjkwMGVkZTZlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjMwVDExMTI1NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTlmOWYxMWYxYzlhZmRlMjYxZjA3ZWJlNDhlODZhNTZiOTI0YjA1ZmZjYjYzMGFiYjFhNWQxYTE4YmViNWFkZDgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.E5keoZK8bimfXV6yS6k5D9heAEhdP6NaASP5r1yfqO0)
debounceTime:
![image](https://private-user-images.githubusercontent.com/16426867/308864367-865a1ce3-c4e1-489f-8b82-090deaab85ee.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk3NDYyNzQsIm5iZiI6MTcxOTc0NTk3NCwicGF0aCI6Ii8xNjQyNjg2Ny8zMDg4NjQzNjctODY1YTFjZTMtYzRlMS00ODlmLThiODItMDkwZGVhYWI4NWVlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjMwVDExMTI1NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTUzY2NkM2JkMWU0M2NkNDAwNGE4NTMwNmI4MjE3ZWFmMWYzYTA5YzQwODJjN2QxMjc0ZmQ5M2JhMTNlYWU0N2ImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.1bjLTMcIsj34RJYSq2TtdlUerP0su7IVIUKh6Errio8)
expected debounceTime with
![image](https://private-user-images.githubusercontent.com/16426867/308864212-a33e69da-b86f-4066-acef-55186dc56c71.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk3NDYyNzQsIm5iZiI6MTcxOTc0NTk3NCwicGF0aCI6Ii8xNjQyNjg2Ny8zMDg4NjQyMTItYTMzZTY5ZGEtYjg2Zi00MDY2LWFjZWYtNTUxODZkYzU2YzcxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjMwVDExMTI1NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNjOTcyNWI1NWE2OTc0ZjBlYWU3MTRjNjQyMmJkZjc1YjNhNTgwN2U4ZGM3NDU3MThjOTBmNWQzMmZhNGE5YTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.VkLJM2m1xeWWXx1OAw5Vb40qrJpEVWFvGmgNSX92n5c)
leading:true
:Beta Was this translation helpful? Give feedback.
All reactions