Menu

1 / 12

Our Widget Is 95 KB. Only 4 KB Loads Up Front.

JavaScript in Plain English - Medium·Alexandre Olive·7 days ago
#NtAaPQpF
Reading 0:00
15s threshold

Our Widget Is 95 KB. Only 4 KB Loads Up Front.

How we keep a third-party review widget from slowing down sites with millions of monthly visits.

Alexandre Olive

10 min read5 hours ago

Most beginner developer courses start by teaching how to display content in a browser using JavaScript.

You create a div, add text to it with innerHTML (don’t do that), and append it to the body. That’s it; you can call yourself a developer.

Just have to put that magnificent piece of code inside a JavaScript file, and you can give it a fancy name like “widget”.

It’s 114 bytes (octets in French) of code; no need for optimization. That baby will run fast. Just adding a script in the header will do the trick.

But what those learning courses don’t teach you is: what do you do when your widget grows to a few hundred KB or even MB?

Ours did in the past. Things pile up.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.