The Best JavaScript Debounce Function in the Universe

If you code in JavaScript, you should know all about debouncing functions.

When an event listener such as a window ‘resize’ fires, sometimes it will fire 72,000 times per second. That means your callback function is also firing 72,000 times in a row, bogging down the browser.

This isn’t as much of a problem as it used to be, but debouncing is still needed and should still be used.

So what’s the best way to debounce/throttle in JavaScript?

(more…)

PikaJS: Think jQuery but smaller, lighter, and just as easy to use

(Updated February 2021 for PikaJS 1.2)

Introducing PikaJS: a jQuery-like JavaScript library that simplifies the client-side scripting of HTML.

I had been using jQuery and PrototypeJS, and I needed to ditch PrototypeJS at long last.

My colleague Michael Franzl said, “Hey! Check out this Balalaika thing!”

So I did.

Unfortunately, Balalaika doesn’t give you many methods to do cool stuff. That’s left as an exercise for the programmer…

So, I decided to make my own jQuery, and PikaJS is the result!

(more…)