【新提案】四个新一元运算符 await.all / await.race / await.allSettled / await.any #12
Replies: 13 comments
-
I'd be happy to co-champion it if someone wanted to invest the time to do the legwork (my plate is a bit too full to take that on right now). |
Beta Was this translation helpful? Give feedback.
-
这个东西我精神上是支持的。只是它的motivation仅仅是少打一点字符,略显单薄。最好能再加点啥。比如或许引擎可以更好地优化啥的(虽然感觉也就是个车轱辘话)。 |
Beta Was this translation helpful? Give feedback.
-
我觉得引擎在这里没什么好优化的,除了能省下去全局找 Promise.* 方法的时间。 |
Beta Was this translation helpful? Give feedback.
-
For me, the motivation isn't just that it's shorter or that it's more robust (avoiding the dynamic |
Beta Was this translation helpful? Give feedback.
-
I didn't notice about stack traces before 🙈 |
Beta Was this translation helpful? Give feedback.
-
Great! can we add some description in README? offtopic: @ljharb What translation service r u use to read chinese ? 😁 |
Beta Was this translation helpful? Give feedback.
-
Current call stack. What's the better form of it? |
Beta Was this translation helpful? Give feedback.
-
Google Translate :-) hopefully I’m getting a close approximation :-p I’m not sure await provides a better call stack with Promise.all currently - check https://mathiasbynens.be/notes/async-stack-traces and https://cloudreports.net/v8-zero-cost-async-stack-traces/ i think? |
Beta Was this translation helpful? Give feedback.
-
只是语法糖的话,感觉用处不大吧,就是少打了几个字。而且,会不会有一些人要求把各种函数都做成算符内置进语法呢? |
Beta Was this translation helpful? Give feedback.
-
@xiaoxiangmoe 比如说? |
Beta Was this translation helpful? Give feedback.
-
Promise 的几个函数能做算符,凭什么我 Array 的不行,凭什么我函数上的不行……于是就出现了很多算符……(这应该去推进自定义算符的提案) |
Beta Was this translation helpful? Give feedback.
-
To me, since |
Beta Was this translation helpful? Give feedback.
-
我觉得这个想法很有意思,能简化批量处理 Promise 的用例(是 ljharb 提的 idea)。不知道有没有人有兴趣一起把它变成提案?
请参阅:https://es.discourse.group/t/allow-awaiting-on-arrays/178/19
Beta Was this translation helpful? Give feedback.
All reactions