From e8e3f31ee6b90fbf630ff6832a99d6ee3f0d6418 Mon Sep 17 00:00:00 2001 From: jaywcjlove Date: Tue, 15 Nov 2022 06:30:03 +0000 Subject: [PATCH] doc: update es6.md, add import assertions (#79) * feat: add import assertions * update 7b4614237245449666f717d46287a37591103c50 --- docs/es6.html | 12 +++++++++++- index.html | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/es6.html b/docs/es6.html index d79c9aa2..035cb208 100644 --- a/docs/es6.html +++ b/docs/es6.html @@ -41,7 +41,7 @@

快速浏览 ES2015、ES2016、ES2017、ES2018 及以后的 JavaScript 新特性

常用

块范围

Let

@@ -490,6 +490,16 @@
new URL('data.txt', import.meta.url)
 

Node.js 环境中,import.meta.url返回的总是本地路径,即 file:URL 协议的字符串,比如 file:///home/user/foo.js

+

导入断言(Import Assertions)

+ +

静态导入

+
import json from "./package.json" assert {type: "json"}
+// 导入 json 文件中的所有对象
+
+

动态导入

+
const json = 
+     await import("./package.json", { assert: { type: "json" } })
+

Generators

Generator 函数

function* idMaker () {
diff --git a/index.html b/index.html
index 3b6686ce..afe49af3 100644
--- a/index.html
+++ b/index.html
@@ -483,6 +483,9 @@
 
 
   zxx-457
+
+
+  吕振波
 
 

贡献者列表,由 contributors 自动生成