Created
July 26, 2012 21:26
-
-
Save ferclaverino/3184637 to your computer and use it in GitHub Desktop.
query object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
"use strict"; | |
var feedNewsMapper; | |
// constructor function | |
function init() { | |
feedNewsMapper = new Mappers.FeedNewsMapper; | |
} | |
var instanceMembers = { | |
getNews: function (section) { | |
var timeSpan = new Date().getTime(); | |
return WinJS.xhr({ | |
url: ApplicationConfiguration.getServiceRootSite() + section + "?c=500&t=" + timeSpan | |
}).then(function (response) { | |
var feedNews = JSON.parse(response.responseText); | |
// map news to model | |
var news = feedNewsMapper.mapNewsToModel(feedNews, section) | |
return WinJS.Promise.wrap(news); | |
}); | |
} | |
}; | |
var staticMembers = {}; | |
var NewsBySectionQuery = WinJS.Class.define(init, instanceMembers, staticMembers); | |
// add to namespace | |
WinJS.Namespace.define("Queries", | |
{ | |
NewsBySectionQuery: NewsBySectionQuery | |
} | |
); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment