Skip to content

Commit 590c82e

Browse files
author
YuChengKai
authored
Merge pull request #143 from zoux/optimize_await_usage
optimize await usage
2 parents 0e9ea3d + d6fd4ae commit 590c82e

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

JS/JS-br.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,9 @@ var obj = {a: 1, b: {
630630
}}
631631
// pay attention that this method is asynchronous
632632
// it can handle `undefined` and circular reference object
633-
const clone = await structuralClone(obj);
633+
(async () => {
634+
const clone = await structuralClone(obj)
635+
})()
634636
```
635637
636638
# Modularization

JS/JS-ch.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,9 @@ var obj = {a: 1, b: {
671671
}}
672672
// 注意该方法是异步的
673673
// 可以处理 undefined 和循环引用对象
674-
const clone = await structuralClone(obj);
674+
(async () => {
675+
const clone = await structuralClone(obj)
676+
})()
675677
```
676678

677679
# 模块化

JS/JS-en.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,9 @@ var obj = {a: 1, b: {
630630
}}
631631
// pay attention that this method is asynchronous
632632
// it can handle `undefined` and circular reference object
633-
const clone = await structuralClone(obj);
633+
(async () => {
634+
const clone = await structuralClone(obj)
635+
})()
634636
```
635637
636638
# Modularization

0 commit comments

Comments
 (0)