Ext.ux.Deferred
Ext.ux.Deferred copied to clipboard
rejecting outside of async function
I know you specifically state the class is for handling Async functions but I just ran in to this issue...
function aSync (val) {
var dfd = Ext.create ('Ext.ux.Deferred') ,
task;
if (val == 0)
dfd.reject('val cannot be zero!');
task = setInterval (function () {
// here your async task
clearInterval (task);
}, 1000);
return dfd;
}
aSync (0).fail (function (result) {
// this never gets called
});
I worked around it by wrapping the dfd.reject in a very short setTimeout. Is there another way of doing this?
First of all, thanks for this issue!
Now, try again with the new version 0.1.0 and please give me a feedback ;)
Wilk
Hi!
Got a similar issue here so maybe no need to open a new ticket. See the simplified example below. In real life I have a mix of async/sync paths within the deferred body. I get an error "TypeError: this.internalPromise is null" once I do:
function myPromise() {
var dfd = Ext.create ('Ext.ux.Deferred');
dfd.resolve('foobar');
return dfd.promise();
}