I have a form where the user can enter markdown-formatted text in a textarea. I'd like to show a quasi live preview of the parsed markdown next to the field.
Exactly like the StackOverflow question form. ;-)
The values of the textarea are being emitted through an RxJS Observable but I don't want to refresh the preview for every new value. Instead I'd like to refresh the preview only after the user has stopped typing for say 500ms.
Here's a tentative diagram (first line is the raw values emitted by the textarea as the user types, second line is what I'd like to obtain; a value is emitted only once a specific delay WITH NO EMISSION has elapsed):
t---t--ttt------tt-ttt------t---|
----------------t-----------t---|
What would be the syntax to achieve this?