Created
March 18, 2014 01:54
-
-
Save jorgeguberte/9612153 to your computer and use it in GitHub Desktop.
DataConnector
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
var DataConnector = (function(){ | |
var apiEndpoint = 'file.json'; | |
return{ | |
acquireData: function(){ | |
deferred = Q.defer(); | |
$.get(apiEndpoint) | |
.done(function(data){ | |
deferred.resolve(data); | |
}) | |
.fail(function(){ | |
deferred.reject(); | |
}); | |
return deferred.promise; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment