I’m currently working on an open source collection of useful code snippets and good practices, over at Orasund/elm-cookbook.
I recently got asked to add an example for how to debounce a form validation:
The validation should only fire if the user has not typed for 500ms.
I’m definitely no expert in that field and I don’t want to reinvent the wheel. That’s why I’m asking for feedback.
Here are a few things to keep in mind:
- I don’t want to include any custom packages. Packages that would do the job are:
- The example should stay slim and simple.
- No over-abstraction like in the elm seed example.
- I intentionally used
Task.sleep, as I believe newcomers have a better understanding as to what a subscription does opposed to what a task does.
If you have any additional insight or useful resources please tell me. Also, I will link this topic in my elm-cookbook; So here’s a quick to all my future readers.