diff options
author | Irvin <irvinfly@gmail.com> | 2022-02-16 02:07:31 +0800 |
---|---|---|
committer | Irvin <irvinfly@gmail.com> | 2022-02-16 02:35:54 +0800 |
commit | d9e9adb5f80a819fe46349bcf6d1faec734b09cd (patch) | |
tree | e856dc5e31aad0a7d5e8c2f98c9ee139d9569a86 /files/zh-cn/web/javascript/reference/global_objects/webassembly | |
parent | 7c2556fe79c44d7c31108b8c8b048d2b7704a95e (diff) | |
download | translated-content-d9e9adb5f80a819fe46349bcf6d1faec734b09cd.tar.gz translated-content-d9e9adb5f80a819fe46349bcf6d1faec734b09cd.tar.bz2 translated-content-d9e9adb5f80a819fe46349bcf6d1faec734b09cd.zip |
remove span tag in zh-CN
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/webassembly')
-rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/webassembly/compileerror/index.html | 2 | ||||
-rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/webassembly/index.html | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/webassembly/compileerror/index.html b/files/zh-cn/web/javascript/reference/global_objects/webassembly/compileerror/index.html index 179b8589a2..9292349082 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/webassembly/compileerror/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/webassembly/compileerror/index.html @@ -15,7 +15,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/CompileError <dl> <dt><code>message</code> {{optional_inline}}</dt> - <dd><span class="tlid-translation translation" lang="zh-CN"><span title="">有可读性的错误描述。</span></span></dd> + <dd>有可读性的错误描述。</dd> <dt><code>fileName</code> {{optional_inline}}{{non-standard_inline}}</dt> <dd>包含导致异常的代码的文件名。</dd> <dt><code>lineNumber</code> {{optional_inline}}{{non-standard_inline}}</dt> 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 66f14793af..87978a0016 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,10 +63,10 @@ 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"><code class="language-js"><span class="keyword token">var</span> importObject <span class="operator token">=</span> <span class="punctuation token">{</span> imports<span class="punctuation token">:</span> <span class="punctuation token">{</span> <span class="function function-variable token">imported_func</span><span class="punctuation token">:</span> <span class="parameter token">arg</span> <span class="operator token">=></span> console<span class="punctuation token">.</span><span class="function token">log</span><span class="punctuation token">(</span>arg<span class="punctuation token">)</span> <span class="punctuation token">}</span> <span class="punctuation token">}</span><span class="punctuation token">;</span> +<pre class="brush: js line-numbers language-js"><code class="language-js">var importObject = { imports: { imported_func: arg => console.log(arg) } }; -WebAssembly<span class="punctuation token">.</span><span class="function token">instantiateStreaming</span><span class="punctuation token">(</span><span class="function token">fetch</span><span class="punctuation token">(</span><span class="string token">'simple.wasm'</span><span class="punctuation token">)</span><span class="punctuation token">,</span> importObject<span class="punctuation token">)</span> -<span class="punctuation token">.</span><span class="function token">then</span><span class="punctuation token">(</span><span class="parameter token">obj</span> <span class="operator token">=></span> obj<span class="punctuation token">.</span>instance<span class="punctuation token">.</span>exports<span class="punctuation token">.</span><span class="function token">exported_func</span><span class="punctuation token">(</span><span class="punctuation token">)</span><span class="punctuation token">)</span></code></pre> +WebAssembly.instantiateStreaming(fetch('simple.wasm'), importObject) +.then(obj => obj.instance.exports.exported_func())</code></pre> <p>返回的<code>ResultObject</code>实例的成员可以被随后访问到,可以调用实例中被导出的方法。</p> |