0

I started reading up on Promise for javascript but I am pretty confused with this thenable object. In the guide (https://promisesaplus.com/), it says that anything that has a then method is a thenable. To me, the only thing that is thenable is a Promise. I can't find anything on the web regarding a thenable object so I was hoping I can get some examples here.

Yu Lin Chen
  • 571
  • 1
  • 6
  • 9
  • I've never heard of it before. Sounds like a made up term... – Corey Ogburn Aug 20 '15 at 16:21
  • jQuery's deferred is a thenable object, but its not strictly to the Promise A+. [JavaScript Promises](http://www.html5rocks.com/en/tutorials/es6/promises/#toc-lib-compatibility) also gives an example. – fuyushimoya Aug 20 '15 at 16:23
  • I'm pretty sure all they're saying is that if you pass an object which defines 'then' as a method, then they will treat it as if it were a promise. Whether it's strictly a promise as defined by any standard is not applicable. This is why you'll hear jquery mentioned as a 'then-able'. – aaaaaa Aug 20 '15 at 16:53
  • @aaaaaa Yeah, that makes more sense. The problem now is I can't even test it out because node currently doesn't support Promise yet. – Yu Lin Chen Aug 20 '15 at 17:01
  • 2
    @YuLinChen: node does support [all these promise implementations](https://promisesaplus.com/implementations). It doesn't matter that it does not have a native `Promise` yet. – Bergi Aug 20 '15 at 18:00

0 Answers0