Why can't I use Promise in node v0.11.11?

后端 未结 1 965
遥遥无期
遥遥无期 2021-01-12 10:28

I\'m just messing around with the v0.11 branch of node, and I\'m wondering why I can\'t use the native ES6 Promise object, even with --harmon

相关标签:
1条回答
  • 2021-01-12 11:12

    Native Promises are in, you can now use them. They're still slower and harder to debug than libraries like Bluebird but they're there.


    Promises currently in Chrome are DOM Futures. Also, they're very experimental and the API might change (it's quite heavily discussed atm).

    Consider using Bluebird promise instead as they're faster, have better stack traces and are stable.

    It is consdierably faster than libraries like Q (two orders of magnitude faster) it has much better stack traces and a completely spec compliant API. You may of course also compile node and v8 yourself - there are promises in v8 itself.

    There are promises in ES6, they're just not 'settled' yet - making the Chrome people are quite angry too

    They're considered part of the DOM too because future DOM APIs will use promises.

    0 讨论(0)
提交回复
热议问题