Is it possible to pass async as false for Ember.RSVP.Promise ?
var promise = new Ember.RSVP.Promise(function(resolve, reject) {
return $.ajax({
url: requestUrl,
type: 'POST',
dataType: 'JSON',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(postData)
}).success(resolve).error(reject);
I mean similar to how we can set when using Ember.$.ajax
var ajaxReq = Ember.$.ajax({
url: "/someService",
data: data,
type: 'post',
dataType: 'json',
async: false,
contentType: 'application/json'
});
No! A Promise can not be executed in sync! This is a javascript limitation.
And you replay don't want this because you have just one Thread. So blocking that Thread would block everything!
A Promise is also not only about AJAX!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.