diff options
| author | Irvin <irvinfly@gmail.com> | 2022-02-16 02:02:49 +0800 |
|---|---|---|
| committer | Irvin <irvinfly@gmail.com> | 2022-02-16 02:35:54 +0800 |
| commit | 01b0e12ba27b5069248fd09235e9a7143915ee30 (patch) | |
| tree | 0e9edf538dc3fa3331e1dbb79239b58186765f86 /files/zh-cn/web/javascript/reference/global_objects/webassembly/table | |
| parent | 6ca84f1794af830ada9736d7289ce29aabb04ca3 (diff) | |
| download | translated-content-01b0e12ba27b5069248fd09235e9a7143915ee30.tar.gz translated-content-01b0e12ba27b5069248fd09235e9a7143915ee30.tar.bz2 translated-content-01b0e12ba27b5069248fd09235e9a7143915ee30.zip | |
remove `notranslate` class in zh-CN
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/webassembly/table')
| -rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/webassembly/table/index.html | 8 |
1 files changed, 4 insertions, 4 deletions
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 9582758e32..9be0f967cd 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 @@ -15,7 +15,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/Table <h2 id="语法">语法</h2> -<pre class="syntaxbox notranslate">var myTable = new WebAssembly.Table(tableDescriptor);</pre> +<pre class="syntaxbox">var myTable = new WebAssembly.Table(tableDescriptor);</pre> <h3 id="参数">参数</h3> @@ -68,14 +68,14 @@ translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/Table <p>The following example (see table2.html <a href="https://github.com/mdn/webassembly-examples/blob/master/js-api-examples/table2.html">source code</a> and <a href="https://mdn.github.io/webassembly-examples/js-api-examples/table2.html">live version</a>) creates a new WebAssembly Table instance with an initial size of 2 elements. We then print out the table length and contents of the two indexes (retrieved via {{jsxref("WebAssembly/Table/get", "Table.prototype.get()")}} to show that the length is two and both elements are {{jsxref("null")}}.</p> -<pre class="brush: js notranslate">var tbl = new WebAssembly.Table({initial:2, element:"anyfunc"}); +<pre class="brush: js">var tbl = new WebAssembly.Table({initial:2, element:"anyfunc"}); console.log(tbl.length); // "2" console.log(tbl.get(0)); // "null" console.log(tbl.get(1)); // "null"</pre> <p>We then create an import object that contains the table:</p> -<pre class="brush: js notranslate">var importObj = { +<pre class="brush: js">var importObj = { js: { tbl:tbl } @@ -83,7 +83,7 @@ console.log(tbl.get(1)); // "null"</pre> <p>Finally, we load and instantiate a wasm module (table2.wasm) using the {{jsxref("WebAssembly.instantiateStreaming()")}} method. The table2.wasm module contains two functions (one that returns 42 and another that returns 83) and stores both into elements 0 and 1 of the imported table (see <a href="https://github.com/mdn/webassembly-examples/blob/master/js-api-examples/table2.wat">text representation</a>). So after instantiation, the table still has length 2, but the elements now contain callable <a href="/en-US/docs/WebAssembly/Exported_functions">Exported WebAssembly Functions</a> which we can call from JS.</p> -<pre class="brush: js notranslate">WebAssembly.instantiateStreaming(fetch('table2.wasm'), importObject) +<pre class="brush: js">WebAssembly.instantiateStreaming(fetch('table2.wasm'), importObject) .then(function(obj) { console.log(tbl.length); console.log(tbl.get(0)()); |
