Created
September 12, 2016 18:37
-
-
Save vishwanatharondekar/9595cc94b389450c6cbe3543c69361be to your computer and use it in GitHub Desktop.
This file contains 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
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