4 ms·
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, an
by darkest_ruby 3y ago
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
- onion2k 3y agoIf 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.