From d34264ca2fd6b360e794e30188edd9043de78eb6 Mon Sep 17 00:00:00 2001 From: Leon Xu <6479451-leonxu260@users.noreply.gitlab.com> Date: Fri, 1 Oct 2021 20:38:32 -0700 Subject: [PATCH] doc: add analogy section --- source/_posts/异步执行.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/source/_posts/异步执行.md b/source/_posts/异步执行.md index df070fd..2bd00b4 100644 --- a/source/_posts/异步执行.md +++ b/source/_posts/异步执行.md @@ -75,4 +75,23 @@ setTimeout(function() { setTimeout(() => { ... }, 2000); +``` +# 比如:你出去吃披萨 +在餐馆,你遵循以下步骤: +- 请求菜单 +- 订一个披萨 +- 检查披萨 +- 吃披萨 +- 支付披萨 +在前一步完成之前,每一步都不能继续。 +```javascript +requestMenu(); +// twiddle thumbs +orderPizza(); +// twiddle thumbs +verifyPizza(); +// twiddle thumbs +eatPizza(); +// twiddle thumbs +payForPizza(); ``` \ No newline at end of file