Jul 21, 2014

Stepping into a pattern for handling asynchronous operations in Java Script called "JavaScript Promise"

I have been currently working on Parse.com and Automatic for my prototyping. I had a problem communication between Parse and Automatic web service through HTTP.

Here is my question on stackoverflow.

Parse.Cloud.httpRequest call with HTTP request header
The point is that I sent an HTTP request but any callback functions are not called.

According to the suggested solution, I found the following two mistakes in my code.

  • Wrong callback function
  • I did not respond to a response from a server 

Thanks to the solution, I could learn how to write a callback function for  asynchronous operations in JavaScript.

This is a pattern for handling asynchronous operations in JavaScript that you can see in JavaScript libraries like AngularJS. It is called "JavaScript Promises".

I stepped into the very beginning of asynchronous operations in JavaScript this time. If I found something interesting, I will write it on this blog.

No comments:

Post a Comment