Download e-book for kindle: JavaScript Promises Essentials by Rami Sarieddine

By Rami Sarieddine

ISBN-10: 178398564X

ISBN-13: 9781783985647

Build absolutely sensible net functions utilizing can provide, the hot regular in JavaScript

About This Book

  • Integrate JavaScript delivers into your program by means of learning the most important strategies of the guarantees API
  • Replace complicated nested callbacks in JavaScript with the extra intuitive chained Promises
  • Acquire the data had to commence operating with JavaScript provides immediately

Who This booklet Is For

If you're a JavaScript developer operating with asynchronous operations and wish to understand extra approximately can provide, then this booklet is perfect for you. Having an in depth clarification of JavaScript provides can be excellent as the next move in the direction of adopting this new common and utilizing the API on your net and JavaScript applications.

What you'll Learn

  • Implement asynchronous programming in JavaScript
  • Get familiar with the JavaScript grants API
  • Choose the correct JavaScript libraries to exploit callbacks in a non-compatible platform
  • Write chained asynchronous operations which are effortless to manage
  • Master WinJS grants for constructing home windows applications
  • Differentiate among numerous implementations of provides in JavaScript
  • Put gives you into motion on your applications
  • Catch and deal with error successfully in asynchronous operations
  • Explore browser help and platform compatibility for JavaScript promises

In Detail

Promises are a brand new programming paradigm in JavaScript that permit builders to request information that they do not have but and care for it at a non-determined aspect sooner or later (asynchronously). beginning with the fundamentals of the promise items, we are going to manage to leverage the utmost functions of offers whilst writing applications.

This e-book starts off through providing you with a few historical past details at the asynchronous programming version in JavaScript, spotting its significance in JavaScript programming. It then walks you thru the main suggestions and intricacies of the guarantees API. Following that, you are going to learn the way you could write advanced asynchronous operations with chained provides and have the ability to capture and deal with exceptions. With this ebook, you will methods to write larger asynchronous operations utilizing JavaScript promises.

Show description

Read Online or Download JavaScript Promises Essentials PDF

Similar javascript books

Read e-book online Professional Perl Programming PDF

Perl is without doubt one of the most crucial scripting languages in use this day. Open resource, freely to be had, transportable, flexible, and strong, strong and straightforward to exploit, Perl is the 1st selection for millions net builders. yet Perl is much greater than a scripting language for the internet. Supported through a accomplished general library and thousands of third-party libraries, Perl is an more and more well known selection for program programming.

Download e-book for kindle: Web development with Apache and Perl : [how to build by Theo Peterson, Visit Amazon's Theo Petersen Page, search

Written for net builders and bosses who're contemplating possible choices to advertisement items, this consultant to Apache and Perl offers details and directions for development websites. standards for choosing an working procedure and techniques for configuring an online server are brought, and a dialogue of Open resource databases and improvement instruments is integrated.

Learn Javascript by Chuck Easttom PDF

This introductory identify in JavaScript goals probably the most renowned programming languages for internet improvement. The identify has a distinct process, utilizing development blocks so readers have built a whole website by means of the tip of the name

Extra resources for JavaScript Promises Essentials

Example text

The then(handler1, handler2) methods register two parallel handlers for a promise, whereby either handler1 or handler2 will be called but never both. catch(handler2), both handlers/functions will be invoked if handler1 rejects, because they represent two separate steps in the promise chain. Promise rejections will move forward to the succeeding then method with a rejection callback only when we have catch as an equivalent of then. Although this does not seem very intuitive at first glance, it is very important to provide an easier reasoning about asynchronous programming and it makes rejecting a promise quite similar to throwing an exception in synchronous programming.

We also saw how we can transform from callback hell to the more readable and maintainable promise chains. In this chapter, we will cover the following topics: • Exceptions and error handling in promise • How to handle errors with promises using then and catch methods Exceptions and promises There is no standard or agreed-on mechanism to handle exceptions in asynchronous JavaScript programming, mainly due to the fact that these exceptions happen in the future and there is no way to tell if a rejected promise will eventually be handled.

Then method and returns a rejected promise by executing the onRejected handler only and neglecting the onFulfilled handler argument for then. catch(function(error) { alert("I have Failed you! " + error); }); The catch() function allowed us to replace the error handler with a more readable function that provides a cleaner approach to handle the errors. [ 40 ] Chapter 4 We can conclude from the previous code samples that there is nothing distinctive about catch, simply its sugarcoating then(null, function) function.

Download PDF sample

JavaScript Promises Essentials by Rami Sarieddine

by Robert

Rated 4.26 of 5 – based on 35 votes