Skip to content

Instantly share code, notes, and snippets.

@vishwanatharondekar
Created September 12, 2016 18:37
Show Gist options
  • Save vishwanatharondekar/9595cc94b389450c6cbe3543c69361be to your computer and use it in GitHub Desktop.
Save vishwanatharondekar/9595cc94b389450c6cbe3543c69361be to your computer and use it in GitHub Desktop.
var dataUpdatePromise = $q.defer();
var params = {
"sportId": 1, //Cricket
"callerId": "scores-tray-caller-id", //TODO : Create constant for this
"onSportsDataLoad": function(data) {
data.matches = prepareMatchesForView(data.matches);
deferred.resolve({
docs: data.matches,
matches: data.matches,
numFound: data.matches.length,
//Caller keeps track of dataUpdatePromise, and when resolved updates the UI with newly received data
dataUpdatePromise: dataUpdatePromise.promise
});
},
"onSportsDataUpdate": function(data) {
data.matches = prepareMatchesForView(data.matches);
var newPromise = $q.defer();
dataUpdatePromise.resolve({
docs: data.matches,
matches: data.matches,
numFound: data.matches.length,
//Caller keeps track of dataUpdatePromise, and when resolved updates the UI with newly received data
dataUpdatePromise: newPromise.promise
});
dataUpdatePromise = newPromise;
},
"gameState": 4, //all matches
"group": false, //default
"leagueCode": 0, //default
"timeZone": "0530", //default
"language": "en" //default
}
MultiSportManager.callSportsCollectionByGameState(params);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment