then / promise

Bare bones Promises/A+ implementation
https://www.promisejs.org
MIT License
2.58k stars 312 forks source link

Act as polyfill #50

Open ForbesLindesay opened 10 years ago

ForbesLindesay commented 10 years ago

We may want to consider using native promises when available in the near future. We would still need to provide Promise.prototype.done and the node.js extensions though.

We would have two options:

  1. Extend the built-in Promise constructor when available and export that, export our custom implementation otherwise.
  2. Inherit from the built in Promise constructor when available, inherit from /lib/core.js otherwise.

We also have a few options when there is no built in promise constructor:

  1. Define Promise globally (in addition to exporting it). Effectively making this library a true polyfill but with some extensions.
  2. Define Promise globally, but only add our special extensions to a copy that inherits from the globally defined Promse.
  3. Continue as we are at the moment.
edef1c commented 9 years ago

Seems we only extend the global Promise object with Promise#done, and not with nodeify/denodeify. Other than that, we seem to have this down.

Zorgatone commented 8 years ago

Any update on this? Would you add the Polyfill just if the Promise global is not defined? What I'm really interested is the nodeify/denodeify feature

TehShrike commented 8 years ago

@Zorgatone I also wanted to use those functions in other environments, so I published them as then-denodeify and then-nodeify.

Zorgatone commented 8 years ago

Oh ok thank you!