<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	「Javascript Promise 学习笔记」的评论	</title>
	<atom:link href="https://note.hzy.pw/2682.html/feed" rel="self" type="application/rss+xml" />
	<link>https://note.hzy.pw/2682.html</link>
	<description>我的个人知识库</description>
	<lastBuildDate>Sun, 12 Feb 2017 02:12:19 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>
	<item>
		<title>
		评论者：Moshel		</title>
		<link>https://note.hzy.pw/2682.html/comment-page-1#comment-7</link>

		<dc:creator><![CDATA[Moshel]]></dc:creator>
		<pubDate>Sun, 12 Feb 2017 02:12:19 +0000</pubDate>
		<guid isPermaLink="false">http://note.hzy.pw/?p=2682#comment-7</guid>

					<description><![CDATA[目前js有很多框架要致力解决js金字塔回调，让异步代码书写的逻辑更为清晰，如async, wind.js, promise, deffer。

async 代码：

&lt;pre&gt;&lt;code&gt;async.waterfall([  
    function Task1(callback) {
        callback(null, &#039;a&#039;);
    },
    function Task2(last, callback) {
        // last now equals &#039;a&#039;
        callback(null, &#039;b&#039;);
    },
    function Task3(last, callback) {
        // last now equals &#039;b&#039;
        callback(null, &#039;done&#039;);
    }
], function (err, result) {
    // result now equals &#039;done&#039;
});
&lt;/code&gt;&lt;/pre&gt;

可读性不比 Promise 差，缺点也和 Promise 一样：

&lt;strong&gt;需要额外的代码来维护这一系列异步代码&lt;/strong&gt;，而 await 就不需要。]]></description>
			<content:encoded><![CDATA[<p>目前js有很多框架要致力解决js金字塔回调，让异步代码书写的逻辑更为清晰，如async, wind.js, promise, deffer。</p>
<p>async 代码：</p>
<pre><code>async.waterfall([  
    function Task1(callback) {
        callback(null, 'a');
    },
    function Task2(last, callback) {
        // last now equals 'a'
        callback(null, 'b');
    },
    function Task3(last, callback) {
        // last now equals 'b'
        callback(null, 'done');
    }
], function (err, result) {
    // result now equals 'done'
});
</code></pre>
<p>可读性不比 Promise 差，缺点也和 Promise 一样：</p>
<p><strong>需要额外的代码来维护这一系列异步代码</strong>，而 await 就不需要。</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		评论者：Moshel		</title>
		<link>https://note.hzy.pw/2682.html/comment-page-1#comment-6</link>

		<dc:creator><![CDATA[Moshel]]></dc:creator>
		<pubDate>Wed, 08 Feb 2017 02:41:35 +0000</pubDate>
		<guid isPermaLink="false">http://note.hzy.pw/?p=2682#comment-6</guid>

					<description><![CDATA[Promise 可运用于 async 函数中的 await 后面，实现最优雅的异步工作。
&lt;a href=&quot;https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/async_function&quot; rel=&quot;nofollow&quot;&gt;https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/async_function&lt;/a&gt;

Promisify 工具：
1. &lt;a href=&quot;https://github.com/digitaldesignlabs/es6-promisify&quot; rel=&quot;nofollow&quot;&gt;https://github.com/digitaldesignlabs/es6-promisify&lt;/a&gt;
2. &lt;a href=&quot;https://github.com/nodegit/promisify-node&quot; rel=&quot;nofollow&quot;&gt;https://github.com/nodegit/promisify-node&lt;/a&gt;]]></description>
			<content:encoded><![CDATA[<p>Promise 可运用于 async 函数中的 await 后面，实现最优雅的异步工作。<br />
<a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/async_function" rel="nofollow">https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/async_function</a></p>
<p>Promisify 工具：<br />
1. <a href="https://github.com/digitaldesignlabs/es6-promisify" rel="nofollow">https://github.com/digitaldesignlabs/es6-promisify</a><br />
2. <a href="https://github.com/nodegit/promisify-node" rel="nofollow">https://github.com/nodegit/promisify-node</a></p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

使用页面缓存Disk: Enhanced 
数据库缓存27/39查询，在0.016秒内使用Disk

Served from: note.hzy.pw @ 2026-06-27 19:11:30 by W3 Total Cache
-->