对es6 中的promise 有兴趣。
这个是js用的吗?
https://github.com/kriskowal/q
1
andy12530 2015 年 5 月 19 日
promise和流程控制没啥关系。
流程控制,你需要async.js |
2
learnshare 2015 年 5 月 19 日
promise 有点像改变了回调的写法,并不是流程控制。
|
3
iyangyuan 2015 年 5 月 19 日 via iPhone
楼主举个例子?
|
4
deathscythe OP |
5
song0071000 2015 年 5 月 19 日
async的 parallel
符合你的要求 |
6
Phariel 2015 年 5 月 19 日 via Android
when.js https://github.com/cujojs/when
|
7
qgy18 2015 年 5 月 19 日 via iPhone
async function myFunction() {
let result = await somethingThatReturnsAPromise(); console.log(result); // cool, we have a result } 这是 ES7 支持的 async function,ES6 可以用 generator function 完成类似的事情,例如 promise 结合 Q,可以这么玩: var all = Q.async(function* () { var src = yield getData(); var img = yield getImg(src); showImg(img); }); |
8
qgy18 2015 年 5 月 19 日 via iPhone
|
9
riophae 2015 年 5 月 19 日
只要 Promise 相关的都可以
|
10
isayme 2015 年 5 月 19 日
献上我写的库给各位大神, 符合promise/A+标准, 仅200行代码!
https://github.com/isayme/then.js |
11
scarlex 2015 年 5 月 19 日
http://liubin.github.io/promises-book/
这里有本 promise book,看完你就懂了 |
12
ezreal 2015 年 5 月 19 日
bluebird
|
13
L3au 2015 年 5 月 19 日
嗯,async & co是流程控制库,都支持promise的
|
14
kurosagi 2015 年 5 月 20 日
|
15
KennyZJ 2015 年 5 月 20 日
co + thunkify
|
16
tamamaxox 2015 年 5 月 20 日
bluebird
|
17
deathscythe OP @qgy18 https://github.com/kriskowal/q 这个用在node.js里的?
|
18
qgy18 2015 年 5 月 20 日
@deathscythe Node 和 浏览器,都可以用。
|