A study on Javascript Promises

Project Description

This project is a study on Javascript promises.

A javascript promise represents the eventual result of an asynchronous operation. It is a placeholder into which the successful result value or reason for failure will materialize.

Some even say that Promises can be seen as the asynchronous version of “try-catch” blocks.

A promise has only three states, pending, resolved or rejected.

This project resulted from lessons obtained in order to perfect my coding capabilities in javascript promises both in ES6 and Angular Q.

Several scenarios were implemented, to try to handle issues like:

  • Handling Promises as objects;
  • Handling resolved or rejected promises;
  • Chaining promises;
  • Changing successes into failures (check weather API scenario);
  • Assigning multiple “callbacks” to a single promise;
  • Handling asynchronous mayhem (what order things come back);
  • Controlling interdependent promises;

Technology Stack

Tha language used was javascript. An Angular framework was also used to test the Q service.

BootstrapJS was applied for visual enhancement.

Lodash and MomentJS were added for coding convenience.

In order to create the several scenarios in the application some API’s were used:

Demo

You can see a running demo of this project in the following link:

JS-Promises

Github

Link for Github Repo

Leave a Reply

Your email address will not be published. Required fields are marked *