HTML and CSS Reference
In-Depth Information
And finally, you get to write the code for the handler and to clear up photos.
flickrApp.clearClick = function () {
flickrApp.clear = function () {
// Zero the length of the list
FlickrFeed.Pictures.splice(0, FlickrFeed.Pictures.length);
You also might want to place a call to flickrApp.clear(); method in the download function just before
placing the remote call. = function (tags) {
// Add tags to the Flickr URL
var url = flickrApp.Source.format(tags);
// Clear existing photos (if any)
// Get new photos
WinJS.xhr({ url: url }).then( ... );
With this final version, you can run as many searches as you want while displaying only the
most recently found photos, which is both less confusing for the user and also improves the overall
application performance.
Being able to access data from a remote location via HTTP is a key feature for nearly every modern
application—especially for applications possibly deployed to a mobile device. In a Windows Store
application written with HTML and JavaScript, you perform HTTP access using the WinJS.xhr object.
In this chapter, you saw two exercises that showed how to make a query via HTTP to get remote data,
and consume the responses containing RSS and JSON data. Although this chapter didn't exhaust the
list of possible HTTP-related tasks, it definitely addresses the most common scenarios.
This chapter concludes the section of the topic dedicated to basic aspects of Windows 8
programming. In the next section, you'll enter more advanced territory—dealing with devices and
sensors, Live tiles, and publishing. The next chapter is about programming against embedded devices
and sensors, such as GPS and webcams.
Search WWH ::

Custom Search