Имеется ввиду, что далее, допустим, deff.resolve() изменяет состояние deferred объекта, запускается deff.done(), а дальше что происходит, где лежит содержимое deff.done() - console.log('Где в объекте лежит функция?'), откуда ее дергает deff.done() из объекта deferred или нет?
var _731531622 = jQuery.Deferred;
jQuery.Deferred = function(func) {
var _object = _731531622(func);
intellisense.annotate(_object, {
'always': function() {
/// <signature>
/// <summary>Add handlers to be called when the Deferred object is either resolved or rejected.</summary>
/// <param name="alwaysCallbacks" type="Function">A function, or array of functions, that is called when the Deferred is resolved or rejected.</param>
/// <param name="alwaysCallbacks" type="Function">Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected.</param>
/// <returns type="Deferred" />
/// </signature>
},
'done': function() {
/// <signature>
/// <summary>Add handlers to be called when the Deferred object is resolved.</summary>
/// <param name="doneCallbacks" type="Function">A function, or array of functions, that are called when the Deferred is resolved.</param>
/// <param name="doneCallbacks" type="Function">Optional additional functions, or arrays of functions, that are called when the Deferred is resolved.</param>
/// <returns type="Deferred" />
/// </signature>
},
'fail': function() {
/// <signature>
/// <summary>Add handlers to be called when the Deferred object is rejected.</summary>
/// <param name="failCallbacks" type="Function">A function, or array of functions, that are called when the Deferred is rejected.</param>
/// <param name="failCallbacks" type="Function">Optional additional functions, or arrays of functions, that are called when the Deferred is rejected.</param>
/// <returns type="Deferred" />
/// </signature>
},
'isRejected': function() {
/// <summary>Determine whether a Deferred object has been rejected.</summary>
/// <returns type="Boolean" />
},
'isResolved': function() {
/// <summary>Determine whether a Deferred object has been resolved.</summary>
/// <returns type="Boolean" />
},
'notify': function() {
/// <signature>
/// <summary>Call the progressCallbacks on a Deferred object with the given args.</summary>
/// <param name="args" type="Object">Optional arguments that are passed to the progressCallbacks.</param>
/// <returns type="Deferred" />
/// </signature>
},
'notifyWith': function() {
/// <signature>
/// <summary>Call the progressCallbacks on a Deferred object with the given context and args.</summary>
/// <param name="context" type="Object">Context passed to the progressCallbacks as the this object.</param>
/// <param name="args" type="Object">Optional arguments that are passed to the progressCallbacks.</param>
/// <returns type="Deferred" />
/// </signature>
},
'pipe': function() {
/// <signature>
/// <summary>Utility method to filter and/or chain Deferreds.</summary>
/// <param name="doneFilter" type="Function">An optional function that is called when the Deferred is resolved.</param>
/// <param name="failFilter" type="Function">An optional function that is called when the Deferred is rejected.</param>
/// <returns type="Promise" />
/// </signature>
/// <signature>
/// <summary>Utility method to filter and/or chain Deferreds.</summary>
/// <param name="doneFilter" type="Function">An optional function that is called when the Deferred is resolved.</param>
/// <param name="failFilter" type="Function">An optional function that is called when the Deferred is rejected.</param>
/// <param name="progressFilter" type="Function">An optional function that is called when progress notifications are sent to the Deferred.</param>
/// <returns type="Promise" />
/// </signature>
},
'progress': function() {
/// <signature>
/// <summary>Add handlers to be called when the Deferred object generates progress notifications.</summary>
/// <param name="progressCallbacks" type="Function">A function, or array of functions, that is called when the Deferred generates progress notifications.</param>
/// <returns type="Deferred" />
/// </signature>
},
'promise': function() {
/// <signature>
/// <summary>Return a Deferred's Promise object.</summary>
/// <param name="target" type="Object">Object onto which the promise methods have to be attached</param>
/// <returns type="Promise" />
/// </signature>
},
'reject': function() {
/// <signature>
/// <summary>Reject a Deferred object and call any failCallbacks with the given args.</summary>
/// <param name="args" type="Object">Optional arguments that are passed to the failCallbacks.</param>
/// <returns type="Deferred" />
/// </signature>
},
'rejectWith': function() {
/// <signature>
/// <summary>Reject a Deferred object and call any failCallbacks with the given context and args.</summary>
/// <param name="context" type="Object">Context passed to the failCallbacks as the this object.</param>
/// <param name="args" type="Array">An optional array of arguments that are passed to the failCallbacks.</param>
/// <returns type="Deferred" />
/// </signature>
},
'resolve': function() {
/// <signature>
/// <summary>Resolve a Deferred object and call any doneCallbacks with the given args.</summary>
/// <param name="args" type="Object">Optional arguments that are passed to the doneCallbacks.</param>
/// <returns type="Deferred" />
/// </signature>
},
'resolveWith': function() {
/// <signature>
/// <summary>Resolve a Deferred object and call any doneCallbacks with the given context and args.</summary>
/// <param name="context" type="Object">Context passed to the doneCallbacks as the this object.</param>
/// <param name="args" type="Array">An optional array of arguments that are passed to the doneCallbacks.</param>
/// <returns type="Deferred" />
/// </signature>
},
'state': function() {
/// <summary>Determine the current state of a Deferred object.</summary>
/// <returns type="String" />
},
'then': function() {
/// <signature>
/// <summary>Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.</summary>
/// <param name="doneFilter" type="Function">A function that is called when the Deferred is resolved.</param>
/// <param name="failFilter" type="Function">An optional function that is called when the Deferred is rejected.</param>
/// <param name="progressFilter" type="Function">An optional function that is called when progress notifications are sent to the Deferred.</param>
/// <returns type="Promise" />
/// </signature>
/// <signature>
/// <summary>Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.</summary>
/// <param name="doneCallbacks" type="Function">A function, or array of functions, called when the Deferred is resolved.</param>
/// <param name="failCallbacks" type="Function">A function, or array of functions, called when the Deferred is rejected.</param>
/// <returns type="Promise" />
/// </signature>
/// <signature>
/// <summary>Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.</summary>
/// <param name="doneCallbacks" type="Function">A function, or array of functions, called when the Deferred is resolved.</param>
/// <param name="failCallbacks" type="Function">A function, or array of functions, called when the Deferred is rejected.</param>
/// <param name="progressCallbacks" type="Function">A function, or array of functions, called when the Deferred notifies progress.</param>
/// <returns type="Promise" />
/// </signature>
},
});
return _object;
};
deff.done() - console.log('Где в объекте лежит функция?'), откуда ее дергает deff.done() из объекта deferred или нет?
В done вы, по сути, уже сами записываете свою функцию
а сам done, как я понимаю, срабатывает при успешном выполнении
т.е., когда срабатывает событие "успешного выполнения"
В done вы, по сути, уже сами записываете свою функцию
Именно, но я не могу найти в методе done свою функцию, я ее записываю, но после манипуляций, console.dir(deff), выведет объект deferred с методами и свойствами, соответственно там есть метод done, но в нем нет упоминания console.log('Где в объекте лежит функция?')....
Garnet_Fox, тут правильнее сказать, что мы не записываем в done свою функцию, а отправляем ее, как агрумент и она [функция] записывается "куда-то" :)
пока еще не докопался куда именно