From 01b0e12ba27b5069248fd09235e9a7143915ee30 Mon Sep 17 00:00:00 2001 From: Irvin Date: Wed, 16 Feb 2022 02:02:49 +0800 Subject: remove `notranslate` class in zh-CN --- files/zh-cn/web/javascript/eventloop/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'files/zh-cn/web/javascript/eventloop') diff --git a/files/zh-cn/web/javascript/eventloop/index.html b/files/zh-cn/web/javascript/eventloop/index.html index 42b31a8fde..f9fdf69207 100644 --- a/files/zh-cn/web/javascript/eventloop/index.html +++ b/files/zh-cn/web/javascript/eventloop/index.html @@ -27,7 +27,7 @@ translation_of: Web/JavaScript/EventLoop

函数调用形成了一个由若干帧组成的栈。

-
function foo(b) {
+
function foo(b) {
   let a = 10;
   return a + b + 11;
 }
@@ -57,7 +57,7 @@ console.log(bar(7)); // 返回 42

之所以称之为 事件循环,是因为它经常按照类似如下的方式来被实现:

-
while (queue.waitForMessage()) {
+
while (queue.waitForMessage()) {
   queue.processNextMessage();
 }
@@ -77,7 +77,7 @@ console.log(bar(7)); // 返回 42

下面的例子演示了这个概念(setTimeout 并不会在计时器到期之后直接执行):

-
const s = new Date().getSeconds();
+
const s = new Date().getSeconds();
 
 setTimeout(function() {
   // 输出 "2",表示回调函数并没有在 500 毫秒之后立即执行
@@ -99,7 +99,7 @@ while(true) {
 
 

基本上,setTimeout 需要等待当前队列中所有的消息都处理完毕之后才能执行,即使已经超出了由第二参数所指定的时间。

-
(function() {
+
(function() {
 
   console.log('这是开始');
 
-- 
cgit v1.2.3-54-g00ecf