Bug Tracker

Changes between Initial Version and Version 1 of Ticket #8067, comment 9


Ignore:
Timestamp:
Feb 1, 2011, 6:26:29 AM (8 years ago)
Author:
jaubourg
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #8067, comment 9

    initial v1  
    1818
    1919As it is today, all it takes to make a third party promise observable is this:
     20{{{
     21    // Make third-party promise observable
     22    thirdPartyPromise.promise = function() {
     23        return this;
     24    }
    2025
    21 // Make third-party promise observable
    22 thirdPartyPromise.promise = function() {
    23    return this;
    24 }
    25 
    26 // Or if the implementation is prototype base
    27 // Add to the prototype so that all promises are now
    28 // observable by jQuery
    29 ThirdPartyPromise.prototype.promise = function() {
    30     return this;
    31 }
    32 
     26    // Or if the implementation is prototype base
     27    // Add to the prototype so that all promises are now
     28    // observable by jQuery
     29    ThirdPartyPromise.prototype.promise = function() {
     30        return this;
     31    }
     32}}}
    3333Another advantage is that, if the third-party is not Promise/A compliant, it's pretty easy to return a Promise/A compliant object by doing some more work in the newly created promise method.
    3434