jQuery - deferred versus promise

Posted by fletchsod on Stack Overflow See other posts from Stack Overflow or by fletchsod
Published on 2013-06-25T21:48:12Z Indexed on 2013/06/25 22:21 UTC
Read the original article Hit count: 159

Filed under:
|
|

What is the difference between Deferred and Promise other than the jQuery versions?

What should I use for my need? I only want to call the fooExecute(). I only need the fooStart() and fooEnd() to toggle the html div status for example.

//I'm using jQuery v2.0.0
function fooStart() { /* Start Notification */ }
function fooEnd() { /* End Notification */ }
function fooExecute() { /* Execute the scripts */ }

$('#button1').on('click', function() {
    var deferred1 = $.Deferred();
    var promise1 = $.Promise();

    deferred1.???

    promise1.???
});

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-deferred