Node.js/异步:修订间差异
来自康健生活
创建页面,内容为“== await == == async == == Promise == <syntaxhighlight lang="javascript"> // bad async function getUserInfo(id) { const profile = await getUserProfile(id); c…” |
|||
| 第1行: | 第1行: | ||
== await == | == await == | ||
接收一个 promise 的时候,一种写法 | |||
<syntaxhighlight lang="javascript"> | |||
initConfig.map(async (v, i) => { | |||
const a = (await v).resources[0].el | |||
await (await layers[i]).appendChild(a) | |||
}); | |||
</syntaxhighlight> | |||
== async == | == async == | ||
== Promise == | == Promise == | ||