Re:Show HN: Replay your typing in a few lines of JavaScript
by darkest_ruby on Saturday March 02, 2024 @01:33AM
(#39570376)
What is everyone excited about? A mediocre piece of code that actually hardcodes th string? Same could be achieved with generic code with 2 Parms - a string, and duration
[ Parent
| on HN ]
Re:Show HN: Replay your typing in a few lines of JavaScript
by onion2k on Saturday March 02, 2024 @06:06AM
(#39571717)
If you want to focus on code maintainability of your web app then you're right - a generalized library with a simple API is the way to go.
On the other hand though, if you want to deliver the minimum code to the user to optimize for download speed, parsing time, and efficiency then a code generator that outputs some 'hardcoded' JS that you drop into the page is the way to go. I really like this approach and I've written plenty of generator functions like this in the past. It's more user-focused than importing a library to the same job.
This is one of the decisions every web dev has to make for themselves. Ideally when a site calls for a tiny function for an effect like this they'll opt for some 'bad' code that results in a better user experience.