posted by steve | Category: Current Projects |
One of the best features that I’ve found so far (and I have many more yet to find) are promises. When building Metro-style apps using JavaScript, the framework utilizes asynchronous requests through xhr. Within that paradigm, there’s a promise object which essentially says that there will be data there sometime in the future (thus the async request). The promise object has a method called then, which accepts three arguments, a success function, error function, and a progress function. This makes the promise object, or the then method, tailored to what we do everyday with AJAX requests: Send a request, give progress and do something with the results (error or success).
Pseudocode:
WinJS.xhr(“http://example.com/webservice”).then(successFunction, errorFunction, progressFunction);
Leave a Reply
Archives
- March 2012
- February 2012
- January 2012
- December 2011
- November 2011
- July 2011
- June 2011
- February 2011
- September 2010
- December 2009
- November 2009
- September 2008
- August 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- March 2007
- December 2006
- August 2006
- July 2006
- December 2005
- September 2005
- August 2005
- July 2005
- June 2005
- May 2005
- March 2005
- February 2005
- December 2004
- October 2004
- September 2004
- July 2004
Categories