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) --- .../reference/global_objects/webassembly/global/index.html | 10 +++------- .../reference/global_objects/webassembly/index.html | 2 +- .../global_objects/webassembly/instance/index.html | 7 +++---- .../global_objects/webassembly/instantiate/index.html | 14 +++++--------- .../webassembly/instantiatestreaming/index.html | 8 ++------ .../reference/global_objects/webassembly/memory/index.html | 10 +++------- .../reference/global_objects/webassembly/module/index.html | 2 +- .../reference/global_objects/webassembly/table/index.html | 2 +- 8 files changed, 19 insertions(+), 36 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/global_objects/webassembly') diff --git a/files/zh-cn/web/javascript/reference/global_objects/webassembly/global/index.html b/files/zh-cn/web/javascript/reference/global_objects/webassembly/global/index.html index c87d989111..4d6b153d0a 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/webassembly/global/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/webassembly/global/index.html @@ -67,7 +67,7 @@ WebAssembly.instantiateStreaming(fetch('global.wasm'), { js: { global } }) });
-

注意: 你可以在running live on GitHub 查看例子; 也可以访问source code.

+

备注:: 你可以在running live on GitHub 查看例子; 也可以访问source code.

规格

@@ -89,13 +89,9 @@ WebAssembly.instantiateStreaming(fetch('global.wasm'), { js: { global } }) -

浏览器兼容性

-
- - -

{{Compat("javascript.builtins.WebAssembly.Global")}}

-
+{{Compat}}

See also

diff --git a/files/zh-cn/web/javascript/reference/global_objects/webassembly/index.html b/files/zh-cn/web/javascript/reference/global_objects/webassembly/index.html index d4b5877590..f2637be5b6 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/webassembly/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/webassembly/index.html @@ -63,7 +63,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly

下面的示例(请参见GitHub上的Instantiate-streaming.html演示,并查看在线演示)直接从流式底层源传输.wasm模块,然后对其进行编译和实例化,并通过ResultObject实现promise。 由于instantiateStreaming()函数接受对 {{domxref("Response")}} 对象的promise,因此您可以直接向其传递{{domxref("WindowOrWorkerGlobalScope.fetch()")}}调用,然后它将把返回的response传递给随后的函数。

-
var importObject = { imports: { imported_func: arg => console.log(arg) } };
+
var importObject = { imports: { imported_func: arg => console.log(arg) } };
 
 WebAssembly.instantiateStreaming(fetch('simple.wasm'), importObject)
 .then(obj => obj.instance.exports.exported_func())
diff --git a/files/zh-cn/web/javascript/reference/global_objects/webassembly/instance/index.html b/files/zh-cn/web/javascript/reference/global_objects/webassembly/instance/index.html index e64f663b93..d66e1554ca 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/webassembly/instance/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/webassembly/instance/index.html @@ -18,7 +18,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance

构造函数

-

重要: 由于大型模块的实例化代价极高, 开发人员应只在必须同步实例化的时候,才使用Instance();绝大多数情况应该使用异步方法{{jsxref("WebAssembly.instantiate()")}} .

+

警告:由于大型模块的实例化代价极高, 开发人员应只在必须同步实例化的时候,才使用Instance();绝大多数情况应该使用异步方法{{jsxref("WebAssembly.instantiate()")}} .

var myInstance = new WebAssembly.Instance(module, importObject);
@@ -41,7 +41,6 @@ translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance
{{jsxref("WebAssembly/Instance/exports", "Instance.prototype.exports")}}
返回一个包含此 WebAssembly 模块实例所导出的全部成员的 JS 对象,以便 JavaScript 访问和使用这些成员,这个对象是只读的。
-

规格

@@ -63,9 +62,9 @@ translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance -

浏览器兼容性

-
{{Compat("javascript.builtins.WebAssembly.Instance")}}
+{{Compat}}

参考

diff --git a/files/zh-cn/web/javascript/reference/global_objects/webassembly/instantiate/index.html b/files/zh-cn/web/javascript/reference/global_objects/webassembly/instantiate/index.html index 43b3aad734..9d0d988668 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/webassembly/instantiate/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/webassembly/instantiate/index.html @@ -12,8 +12,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiate
  • 第二种重载使用已编译的 {{jsxref("WebAssembly.Module")}} , 返回的 Promise 携带一个 Module的实例化对象 Instance. 如果这个 Module 已经被编译了或者是从缓存中获取的( retrieved from cache), 那么这种重载方式是非常有用的.
  • -
    -

    重要: 此方法不是获取(fetch)和实例化wasm模块的最具效率方法。 如果可能的话,您应该改用较新的{{jsxref("WebAssembly.instantiateStreaming()")}}方法,该方法直接从原始字节码中直接获取,编译和实例化模块,因此不需要转换为{{jsxref("ArrayBuffer")}}。

    +
    +

    警告:此方法不是获取(fetch)和实例化wasm模块的最具效率方法。 如果可能的话,您应该改用较新的{{jsxref("WebAssembly.instantiateStreaming()")}}方法,该方法直接从原始字节码中直接获取,编译和实例化模块,因此不需要转换为{{jsxref("ArrayBuffer")}}。

    语法

    @@ -103,7 +103,7 @@ fetch('simple.wasm').then(response => );
    -

    : 查看GitHub(在线实例)的 index.html 中一个相似的例子,使用了我们的fetchAndInstantiate()库函数

    +

    备注:: 查看GitHub(在线实例)的 index.html 中一个相似的例子,使用了我们的fetchAndInstantiate()库函数

    第二种重载例子

    @@ -158,13 +158,9 @@ onmessage = function(e) { -

    浏览器兼容性

    -
    - - -

    {{Compat("javascript.builtins.WebAssembly.instantiate")}}

    -
    +{{Compat}}

    参见

    diff --git a/files/zh-cn/web/javascript/reference/global_objects/webassembly/instantiatestreaming/index.html b/files/zh-cn/web/javascript/reference/global_objects/webassembly/instantiatestreaming/index.html index 15af74d96b..9283dfc9c2 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/webassembly/instantiatestreaming/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/webassembly/instantiatestreaming/index.html @@ -66,13 +66,9 @@ WebAssembly.instantiateStreaming(fetch('simple.wasm'), importObject) -

    浏览器兼容性

    -
    - - -

    {{Compat("javascript.builtins.WebAssembly.instantiateStreaming")}}

    -
    +{{Compat}}

    See also

    diff --git a/files/zh-cn/web/javascript/reference/global_objects/webassembly/memory/index.html b/files/zh-cn/web/javascript/reference/global_objects/webassembly/memory/index.html index f8319d669c..f3f0afebe5 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/webassembly/memory/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/webassembly/memory/index.html @@ -28,7 +28,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory
    -

    注意: A WebAssembly 页面的大小为一个常量 65,536 字节,即64KB。

    +

    备注:: A WebAssembly 页面的大小为一个常量 65,536 字节,即64KB。

    异常

    @@ -95,13 +95,9 @@ translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory -

    浏览器兼容性

    -
    - - -

    {{Compat("javascript.builtins.WebAssembly.Memory")}}

    -
    +{{Compat}}

    参见

    diff --git a/files/zh-cn/web/javascript/reference/global_objects/webassembly/module/index.html b/files/zh-cn/web/javascript/reference/global_objects/webassembly/module/index.html index 5f3839d6b2..eb2fee5a2a 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/webassembly/module/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/webassembly/module/index.html @@ -16,7 +16,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/Module

    构造函数语法

    -

    重要提示:由于大型模块的编译可能很消耗资源,开发人员只有在绝对需要同步编译时,才使用 Module() 构造函数;其他情况下,应该使用异步 {{jsxref("WebAssembly.compile()")}} 方法。

    +

    警告:由于大型模块的编译可能很消耗资源,开发人员只有在绝对需要同步编译时,才使用 Module() 构造函数;其他情况下,应该使用异步 {{jsxref("WebAssembly.compile()")}} 方法。

    var myModule = new WebAssembly.Module(bufferSource);
    diff --git a/files/zh-cn/web/javascript/reference/global_objects/webassembly/table/index.html b/files/zh-cn/web/javascript/reference/global_objects/webassembly/table/index.html index 5e1b468f38..ff779c45fb 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/webassembly/table/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/webassembly/table/index.html @@ -10,7 +10,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/Table

    这是一个包装了WebAssemble Table 的Javascript包装对象,具有类数组结构,存储了多个函数引用。在Javascript或者WebAssemble中创建Table 对象可以同时被Javascript或WebAssemble 访问和更改。

    -

    Note: Tables 对象目前只能存储函数引用,不过在将来可能会被扩展。

    +

    备注:: Tables 对象目前只能存储函数引用,不过在将来可能会被扩展。

    语法

    -- cgit v1.2.3-54-g00ecf