admin管理员组文章数量:1327745
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 --harmony
turned on.
My normal chrome browsers:
Google Chrome 32.0.1700.77 (Official Build 244503)
JavaScript V8 3.22.24.10
Supports them, and node.js v0.11.11
is telling me:
> process.versions.v8
'3.22.24.19'
So what gives?
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 --harmony
turned on.
My normal chrome browsers:
Google Chrome 32.0.1700.77 (Official Build 244503)
JavaScript V8 3.22.24.10
Supports them, and node.js v0.11.11
is telling me:
> process.versions.v8
'3.22.24.19'
So what gives?
Share Improve this question asked Feb 13, 2014 at 12:17 user578895user578895 4- 2 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 stable. – Benjamin Gruenbaum Commented Feb 13, 2014 at 12:18
- So basically because it's a DOM api and not a javascript API. – mpm Commented Feb 13, 2014 at 12:19
- 1 @mpm there are promises in ES6, they're just not 'settled' yet - the Chrome people are quite angry too : esdiscuss/topic/promise-cast-and-promise-resolve#content-77 – Benjamin Gruenbaum Commented Feb 13, 2014 at 12:21
-
@BenjaminGruenbaum -- Well that explains why node doesn't have them, but why are they considered part of the DOM??? I've been using
q
forever, this isn't an issue of me wanting to find a library, just curious why it didn't work. If you post an answer, I'll accept it :) – user578895 Commented Feb 13, 2014 at 12:21
1 Answer
Reset to default 10Native 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 pletely spec pliant API. You may of course also pile 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.
本文标签: javascriptWhy can39t I use Promise in node v01111Stack Overflow
版权声明:本文标题:javascript - Why can't I use Promise in node v0.11.11? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742231382a2437279.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论