Strategies for handling asynchronous information
Consuming information from an API is a typical operation in our daily development workflow. We consume data over HTTP all the time, such as when authenticating users by sending out credentials to an authentication service. We also use HTTP when fetching the latest tweets in our favorite Twitter widget. Modern mobile devices have introduced a unique way of consuming remote services. They defer requests and response consumption until mobile connectivity is available. Responsivity and availability have become a big deal. Although internet connections are high-speed nowadays, there is always a response time involved when serving such information. Thus, as we will see in the following sections, we put in place mechanisms to handle states in our applications in a transparent way for the end user.
Shifting from callback hell to promises
Sometimes, we might need to build functionalities in our application that change its state asynchronously...