Archive for the ‘Promises’ Category

Async Operations in React Redux Applications

Posted on: No Comments
This post was originally posted at Codebrahma. JavaScript is a single-threaded programming language. That is, when you have code something like this … … the second line doesn't get executed till the first one gets completed. Mostly this won't be a...

Simplifying Asynchronous Coding with Async Functions

Posted on: No Comments
The debut of Promises in JavaScript has lit the internet on fire—they help developers break out of callback hell and solve a lot of problems that have plagued the asynchronous code of JavaScript programmers everywhere. Promises are far from flawless,...

The Promise of a Burger Party

Posted on: No Comments
Mariko Kosaka with an elaborate and wonderful metaphor. What is a Promise in JavaScript? It's like if you go to a restaurant and order a burger and a shake. The restaurant needs to prepare your food, so after you pay, you get a tray with a buzzer on it...

Quick Tip: What Are Factory Functions in JavaScript

Posted on: No Comments
You can't get far as a JavaScript programmer without learning about functions and objects, and when used together, they are the building blocks we need to get started with a powerful object paradigm called composition. Today we'll look at some idiomati...

An Introduction to jQuery’s Deferred Objects

Posted on: No Comments
For a long time, JavaScript developers have used callback functions to perform several tasks. A very common example is to add a callback via the addEventListener() function to execute various operations when an event, such as click or keypress, is fire...

Face Proximity Detection with JavaScript

Posted on: No Comments
Let’s suppose you'd like to let the visitors of your website make a video recording or take a picture of their face. How can you explain to them how close they're supposed to sit to the camera? You could write lengthy instructions, but you know that ...

Preloading Images in Parallel with Promises

Posted on: No Comments
The topic of this article is actually quite specific. Recently, I faced a situation where I needed to preload a lot of images in parallel. With the given constraints, it ended up being more challenging than first expected, and I certainly learnt a lot ...

Promises in JavaScript Unit Tests: the Definitive Guide

Posted on: No Comments
Promises are becoming a common part of JavaScript code. The native Promise object is already supported by all the major browsers including Chrome, Firefox, and Safari. Despite making asynchronous code simpler, dealing with promises in unit tests is a h...