Getting the code structure ready

As we did in previous chapter, Chapter 3, Creating a Website Tour, we will use the object literal pattern to keep our code manageable and inside a single object. We will define an object named myReddit, inside which there will be properties and methods (they can be called members as well) to create our news reader. Let's start by writing the code for the same in the myReddit.js file:

var myReddit = { apiURL : 'http://www.reddit.com', tabCount : 1, init : function() { }, getJSONFromAPI : function(type, id) { }, createTab : function(subredditName, postList) { }, getPostListingHtml : function(postListing) { }, displayComments : function(data) { }, getCommentsHTML : function(commentsList) { }, htmlDecode : function(input) ...

Get Mastering jQuery UI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.