JavaScript Tutorials
How to Fix ESLint Errors Upon Save in VS Code
Two of the most prominent utilities in web development today are ESLint and Microsoft's Visual Studio Code. I enjoy using both, and I love the integration between both tools, but warnings from ESLint inside Visual Studio Code aren't fulfilling -- I'd rather lint errors be...
How to Add Native Keyword Aliases to Babel
Those of you who follow this blog know that not every blog post is an endorsement of a technique but simply a tutorial how to accomplish something. Sometimes the technique described is probably not something you should do. This is one of those blog...
JavaScript Picture-in-Picture API
As a huge fan of media on the web, I'm always excited about enhancements to how we can control our media. Maybe I get excited about simple things like the
<video>
tag and its associated elements and attributes because media on the web started with custom...How to Cancel a Fetch Request
JavaScript promises have always been a major win for the language -- they've led to a revolution of asynchronous coding that has vastly improved performance on the web. One shortcoming of native promises is that there's no true way to cancel a
fetch
...until now. A...Lazy Object Initialization
The Firefox DevTools underlying code, which is written with JavaScript and HTML, is a complex application. Due to the complexity and amount of work going on, the DevTools team has done everything they can to load as little as possible. Furthermore the team has...
Override window.alert
For years the only bit of feedback web developers could get was via
alert("{str}")
calls. These days we have the web console but, in rare cases, we don't have a console andalert
calls are our only window into a value at a given time.One problem...Duplicated Argument Names
Oftentimes we override or monkey patch functions and, in many cases, there are arguments we don't care too much about. A common practice for those arguments is using
_
for argument names -- it's a generally accepted and known practice for "this isn't important".Image Lazy Loading
Lazy loading images is a practice that's been popular for a decade and for good reason: images are usually the heaviest downloads on a given webpage and avoiding unloading images that are never seen saves the user bandwidth. There are plugins for lazy loading images in...
JavaScript waitForTime
I write a lot of tests for new features within Firefox DevTools. We have hundreds of "mochitests" which open the browser and perform synthetic actions like clicking, typing, and other user actions. I've previously written about
waitForever
which essentially halts following actions without locking the...How to Create a QR Code
QR codes aren't everyone's cup of tea but I quite like them. If I see something I want to remember or check out later, especially when on the road, it's super easy to take a quick picture -- it's much easier than trying to remember a...