diff options
author | Irvin <irvinfly@gmail.com> | 2022-02-16 02:14:18 +0800 |
---|---|---|
committer | Irvin <irvinfly@gmail.com> | 2022-02-16 02:35:54 +0800 |
commit | d44f5032d0f53256b2d5aef505d6b593fd3cd158 (patch) | |
tree | 4b585f4be9c9a2712664ad10e7acf62c83fff51f /files/zh-cn/web/javascript/reference/global_objects/webassembly | |
parent | f45e9e070c93ebbd83d488bdd775987a4d75c201 (diff) | |
download | translated-content-d44f5032d0f53256b2d5aef505d6b593fd3cd158.tar.gz translated-content-d44f5032d0f53256b2d5aef505d6b593fd3cd158.tar.bz2 translated-content-d44f5032d0f53256b2d5aef505d6b593fd3cd158.zip |
fix yari h2m dry run errors (zh-CN)
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/webassembly')
8 files changed, 19 insertions, 36 deletions
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 } }) });</pre> <div class="note"> -<p><strong>注意</strong>: 你可以在<a href="https://mdn.github.io/webassembly-examples/js-api-examples/global.html">running live on GitHub</a> 查看例子; 也可以访问<a href="https://github.com/mdn/webassembly-examples/blob/master/js-api-examples/global.html">source code</a>.</p> +<p><strong>备注:</strong>: 你可以在<a href="https://mdn.github.io/webassembly-examples/js-api-examples/global.html">running live on GitHub</a> 查看例子; 也可以访问<a href="https://github.com/mdn/webassembly-examples/blob/master/js-api-examples/global.html">source code</a>.</p> </div> <h2 id="规格">规格</h2> @@ -89,13 +89,9 @@ WebAssembly.instantiateStreaming(fetch('global.wasm'), { js: { global } }) </tbody> </table> -<h2 id="Browser_compatibility" +<h2 id="浏览器兼容性">浏览器兼容性</h2> -<div> - - -<p>{{Compat("javascript.builtins.WebAssembly.Global")}}</p> -</div> +{{Compat}} <h2 id="See_also">See also</h2> 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 <p>下面的示例(请参见GitHub上的<a href="https://github.com/mdn/webassembly-examples/blob/master/js-api-examples/instantiate-streaming.html">Instantiate-streaming.html</a>演示,并查看<a href="https://mdn.github.io/webassembly-examples/js-api-examples/instantiate-streaming.html">在线演示</a>)直接从流式底层源传输.wasm模块,然后对其进行编译和实例化,并通过<code>ResultObject</code>实现promise。 由于<code>instantiateStreaming()</code>函数接受对 {{domxref("Response")}} 对象的promise,因此您可以直接向其传递{{domxref("WindowOrWorkerGlobalScope.fetch()")}}调用,然后它将把返回的response传递给随后的函数。</p> -<pre class="brush: js line-numbers language-js">var importObject = { imports: { imported_func: arg => console.log(arg) } }; +<pre class="brush: js">var importObject = { imports: { imported_func: arg => console.log(arg) } }; WebAssembly.instantiateStreaming(fetch('simple.wasm'), importObject) .then(obj => obj.instance.exports.exported_func())</pre> 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 <h2 id="构造函数">构造函数</h2> <div class="warning"> -<p><strong>重要</strong>: 由于大型模块的实例化代价极高, 开发人员应只在必须同步实例化的时候,才使用<code>Instance()</code>;绝大多数情况应该使用异步方法{{jsxref("WebAssembly.instantiate()")}} .</p> +<p><strong>警告:</strong>由于大型模块的实例化代价极高, 开发人员应只在必须同步实例化的时候,才使用<code>Instance()</code>;绝大多数情况应该使用异步方法{{jsxref("WebAssembly.instantiate()")}} .</p> </div> <pre class="syntaxbox">var myInstance = new WebAssembly.Instance(<em>module</em>, <em>importObject</em>);</pre> @@ -41,7 +41,6 @@ translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance <dl> <dt>{{jsxref("WebAssembly/Instance/exports", "Instance.prototype.exports")}}</dt> <dd>返回一个包含此 WebAssembly 模块实例所导出的全部成员的 JS 对象,以便 JavaScript 访问和使用这些成员,这个对象是只读的。</dd> - <dt></dt> </dl> <h2 id="规格">规格</h2> @@ -63,9 +62,9 @@ translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance </tbody> </table> -<h2 id="Browser_compatibility" +<h2 id="浏览器兼容性">浏览器兼容性</h2> -<div>{{Compat("javascript.builtins.WebAssembly.Instance")}}</div> +{{Compat}} <h2 id="参考">参考</h2> 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 <li>第二种重载使用已编译的 {{jsxref("WebAssembly.Module")}} , 返回的 <code>Promise</code> 携带一个 <code>Module</code>的实例化对象 <code>Instance</code>. 如果这个 <code>Module</code> 已经被编译了或者是从缓存中获取的( <a href="/en-US/docs/WebAssembly/Caching_modules">retrieved from cache</a>), 那么这种重载方式是非常有用的.</li> </ul> -<div class="blockIndicator warning"> -<p><strong>重要</strong>: 此方法不是获取(fetch)和实例化wasm模块的最具效率方法。 如果可能的话,您应该改用较新的{{jsxref("WebAssembly.instantiateStreaming()")}}方法,该方法直接从原始字节码中直接获取,编译和实例化模块,因此不需要转换为{{jsxref("ArrayBuffer")}}。</p> +<div class="warning"> +<p><strong>警告:</strong>此方法不是获取(fetch)和实例化wasm模块的最具效率方法。 如果可能的话,您应该改用较新的{{jsxref("WebAssembly.instantiateStreaming()")}}方法,该方法直接从原始字节码中直接获取,编译和实例化模块,因此不需要转换为{{jsxref("ArrayBuffer")}}。</p> </div> <h2 id="语法">语法</h2> @@ -103,7 +103,7 @@ fetch('simple.wasm').then(response => );</pre> <div class="note"> -<p><strong>注</strong>: 查看GitHub(<a href="https://mdn.github.io/webassembly-examples/js-api-examples/">在线实例</a>)的 <a href="https://github.com/mdn/webassembly-examples/blob/master/js-api-examples/index.html">index.html</a> 中一个相似的例子,使用了我们的<code><a href="https://github.com/mdn/webassembly-examples/blob/master/wasm-utils.js#L1">fetchAndInstantiate()</a></code>库函数</p> +<p><strong>备注:</strong>: 查看GitHub(<a href="https://mdn.github.io/webassembly-examples/js-api-examples/">在线实例</a>)的 <a href="https://github.com/mdn/webassembly-examples/blob/master/js-api-examples/index.html">index.html</a> 中一个相似的例子,使用了我们的<code><a href="https://github.com/mdn/webassembly-examples/blob/master/wasm-utils.js#L1">fetchAndInstantiate()</a></code>库函数</p> </div> <h3 id="第二种重载例子">第二种重载例子</h3> @@ -158,13 +158,9 @@ onmessage = function(e) { </tbody> </table> -<h2 id="Browser_compatibility" +<h2 id="浏览器兼容性">浏览器兼容性</h2> -<div> - - -<p>{{Compat("javascript.builtins.WebAssembly.instantiate")}}</p> -</div> +{{Compat}} <h2 id="参见">参见</h2> 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) </tbody> </table> -<h2 id="Browser_compatibility" +<h2 id="浏览器兼容性">浏览器兼容性</h2> -<div> - - -<p>{{Compat("javascript.builtins.WebAssembly.instantiateStreaming")}}</p> -</div> +{{Compat}} <h2 id="See_also">See also</h2> 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 </dl> <div class="note"> -<p><strong>注意</strong>: A WebAssembly 页面的大小为一个常量 65,536 字节,即64KB。</p> +<p><strong>备注:</strong>: A WebAssembly 页面的大小为一个常量 65,536 字节,即64KB。</p> </div> <h3 id="异常">异常</h3> @@ -95,13 +95,9 @@ translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory </tbody> </table> -<h2 id="Browser_compatibility" +<h2 id="浏览器兼容性">浏览器兼容性</h2> -<div> - - -<p>{{Compat("javascript.builtins.WebAssembly.Memory")}}</p> -</div> +{{Compat}} <h2 id="参见">参见</h2> 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 <h2 id="构造函数语法">构造函数语法</h2> <div class="warning"> -<p><strong>重要提示:</strong>由于大型模块的编译可能很消耗资源,开发人员只有在绝对需要同步编译时,才使用 <code>Module()</code> 构造函数;其他情况下,应该使用异步 {{jsxref("WebAssembly.compile()")}} 方法。</p> +<p><strong>警告:</strong>由于大型模块的编译可能很消耗资源,开发人员只有在绝对需要同步编译时,才使用 <code>Module()</code> 构造函数;其他情况下,应该使用异步 {{jsxref("WebAssembly.compile()")}} 方法。</p> </div> <pre class="syntaxbox">var myModule = new WebAssembly.Module(bufferSource);</pre> 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 <p>这是一个包装了WebAssemble Table 的Javascript包装对象,具有类数组结构,存储了多个函数引用。在Javascript或者WebAssemble中创建Table 对象可以同时被Javascript或WebAssemble 访问和更改。</p> <div class="note"> -<p><strong>Note</strong>: Tables 对象目前只能存储函数引用,不过在将来可能会被扩展。</p> +<p><strong>备注:</strong>: Tables 对象目前只能存储函数引用,不过在将来可能会被扩展。</p> </div> <h2 id="语法">语法</h2> |