DEV Community

Discussion on: Do you still work with jQuery?

 
anilseervi profile image
Anil Seervi

Top level awaits tho

Thread Thread
 
link2twenty profile image
Andrew Bone • Edited

Helper functions can also be a thing.

const getJSON = async (url, callback) => {
  const response = await fetch(url);
  const data = await response.json();
  callback(data)
}

getJSON("/my/url", console.log);
Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
nataliedeweerd profile image
𝐍𝐚𝐭𝐚𝐥𝐢𝐞 𝐝𝐞 𝐖𝐞𝐞𝐫𝐝

I understand where you're coming from, but for modern Internet speeds 30kb is nothing. Sure, it's worth taking into account if you're launching a site for a territory which suffers from slow Internet speeds, but for most affluent countries I'd argue 30kb is not worth losing sleep over.

In the UK the average Internet speed in 2015 was 13 MBps. https://www.mindgems.com/info/file-download-time-calculator/?FileSize=30&Units=kilobytes It really takes no time at all to download such a tiny file.