Last active
June 22, 2016 14:37
-
-
Save knownasilya/9472916 to your computer and use it in GitHub Desktop.
RSVP jquery ajax wrapper
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
function ajax(url, options) { | |
return new Ember.RSVP.Promise(function (resolve, reject) { | |
options = options || {}; | |
options.url = url; | |
options.success = function (data) { | |
Ember.run(null, resolve, data); | |
}; | |
options.error = function () { | |
Ember.run(null, reject, arguments); | |
}; | |
Ember.$.ajax(options); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@knownasilya what for used
run
?