Skip to content

rejecting outside of async function #6

@ahj

Description

@ahj

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions