From d44f5032d0f53256b2d5aef505d6b593fd3cd158 Mon Sep 17 00:00:00 2001 From: Irvin Date: Wed, 16 Feb 2022 02:14:18 +0800 Subject: fix yari h2m dry run errors (zh-CN) --- files/zh-cn/web/javascript/guide/using_promises/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'files/zh-cn/web/javascript/guide/using_promises') diff --git a/files/zh-cn/web/javascript/guide/using_promises/index.html b/files/zh-cn/web/javascript/guide/using_promises/index.html index 22a0163216..5d7c65bf68 100644 --- a/files/zh-cn/web/javascript/guide/using_promises/index.html +++ b/files/zh-cn/web/javascript/guide/using_promises/index.html @@ -36,13 +36,13 @@ createAudioFileAsync(audioSettings, successCallback, failureCallback)

如果函数 createAudioFileAsync() 被重写为返回 Promise 的形式,那么我们可以像下面这样简单地调用它:

-
const promise = createAudioFileAsync(audioSettings);
+
const promise = createAudioFileAsync(audioSettings);
 promise.then(successCallback, failureCallback);
 

或者简写为:

-
createAudioFileAsync(audioSettings).then(successCallback, failureCallback);
+
createAudioFileAsync(audioSettings).then(successCallback, failureCallback);
 

我们把这个称为 异步函数调用,这种形式有若干优点,下面我们将会逐一讨论。

@@ -65,7 +65,7 @@ promise.then(successCallback, failureCallback);

见证奇迹的时刻:then() 函数会返回一个和原来不同的新的 Promise

-
const promise = doSomething();
+
const promise = doSomething();
 const promise2 = promise.then(successCallback, failureCallback);
 
-- cgit v1.2.3-54-g00ecf