What's the difference between a Deferred object and its own promise object?

后端 未结 3 609
悲&欢浪女
悲&欢浪女 2020-12-05 00:34

Let\'s create a simple Deferred object:

defer = $.Deferred( function ( defer ) {
    setTimeout( defer.resolve, 3000 );
});

The above Defer

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-05 01:11

    With Deferred, you can control its state set.

    When it comes to the Promise, you can read state and maybe attach callback. get

提交回复
热议问题