Promises Tutorials
Node.js Port Scanner
Node.js has become an incredible tool for creating services or utilities that act like a service. Usually it's
npm start
, wait a moment, and you'll see the utility provide an address and port; a good example beinglocalhost:8000
. One thing that bugs me about this pattern...async & await
JavaScript promises were a revelation in JavaScript, providing an alternative to the JavaScript callback hell we'd quickly found ourselves in. Promises also allowed us to introduce and better handle asynchronous tasks. While promises were an improvement over callback hell, they still require lots of
then
s...Detect WEBP Support with JavaScript
Image optimization is a huge part of improving front-end performance. We've traditionally used JPG/JPEG, GIF, and PNG images but Google and the Chrome team developed the WEBP format which crunches file size and optimizes rendering. If you go to a site like GIPHY in Chrome you'll...
Promise.all for Rejections and Resolves
Promises have been an incredible addition to JavaScript; they save us callback hell, make coding async more maintainable, and and allow us to keep track of multiple async processes at a time.
Promise.all
comes to mind, allowing us to react when multiple promises have been resolved. UnfortunatelyPromise.all
only resolves when...Modernization of Reactivity
Reactive programming has taken JavaScript by storm over the last decade, and for good reason; front-end development greatly benefits from the simplicity of writing user interface code that "reacts" to data changes, eliminating substantial error-prone imperative code tasked with updating UIs. However, while the popularity has...
Building Ambitious Web Applications with Ember.js
Ember.js is a solid single page application framework for building modern web applications.Before Angular and React reached critical mass, Ember.js was leading the charge in building scalable single page applications. While the spotlight may have shifted, Ember.js remains a great and viable option...
JavaScript sleep Function
The infamous
sleep
, ordelay
, function within any language is much debated. Some will say that there should always be a signal or callback to fire a given functionality, others will argue that sometimes an arbitrary moment of delay is useful. I say that to each their own...Permissions API
Many of the functionalities that we're translated from mobile to the web require permission from the user. Think about geolocation, audio/video access (think getUserMedia for camera access), and likewise APIs. We can probably all agree that requiring permission for access to these APIs is a good thing, but I see a...
Cache API
The awesome ServiceWorker API is meant to give developers a bit more control over what is and isn't cached, and how. Sure we can play games with ETags and the like but doing it programmatically with JavaScript just feels better, more controllable. As with every API, however, adding stuff to...
Create a Basic Loader with JavaScript Promises
I've used JavaScript loaders for years; whether it was the Dojo loader, curl.js, or even using jQuery as a JavaScript loader, it's incredibly useful to request a set of resources and react once they've completed loading. Each JavaScript loader is feature-packed, efficient, and does a wonderful job...