Tuesday, 15 August 2017

Tech Tuesday: Common Patterns for Promises in Javascript

Aaron Starkston, Lead Developer, Product Development
Technology / Platforms

Most modern applications using a client-side layer take advantage of Javascript Promises. For those not familiar, the concept of promises is to take a block of code to run asynchronously. The developer can continue normal operations and forget (temporarily) about the code, trusting the native Promise API will notify us once that code finishes running so we can run code inside a callback method.

Not only is this useful for long running calculations, but vital for (single or multiple) client-server calls. Promises are the backbone for modern applications consuming any type of data from an external source.

There are numerous benefits from promise-based programming, but often difficult to implement correctly. A large problem source seen during code reviews has been incorrectly chaining promises.

Find out more about correctly chaining multiple promises for proper data manipulation, implementing proper error handling, and avoiding unnecessary callbacks.

Read the full article here.


Aaron Starkston is a Senior Developer at Rightpoint. Follow Aaron on LinkedIn and Medium.