pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://developer.mozilla.org/ja/docs/WebAssembly/Reference/JavaScript_interface/Table/get

/script>

このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

WebAssembly.Table.prototype.get()

Baseline 広く利用可能

この機能は広く実装されており、多くのバージョンの端末やブラウザーで動作します。2017年10月以降、すべてのブラウザーで利用可能です。

get()WebAssembly.Table オブジェクトのプロトタイプメソッドで、指定された位置に格納されている関数参照を取得します。

構文

js
get(index);

引数

index

取得する関数参照の位置です。

返値

関数参照を返します。これはエクスポートされた WebAssembly 関数、wasm 関数を内在する JavaScript ラッパーです。

例外

indexTable.prototype.length 以上であった場合、RangeError が発生します。

get の使用

次の例では (Github の table.html動作例も確認してください)、 table.wasm バイトコードを WebAssembly.instantiateStreaming() メソッドを使用して読み取り、コンパイルしてインスタンス化しています。その後、エクスポートされたテーブルに格納された参照を取得します。

js
WebAssembly.instantiateStreaming(fetch("table.wasm")).then(function (obj) {
  var tbl = obj.instance.exports.tbl;
  console.log(tbl.get(0)()); // 13
  console.log(tbl.get(1)()); // 42
});

参照に格納されている値を実際に取得するためには、アクセサーの最後に 2 つ目の関数呼び出し演算子を含める必要があります (get(0) ではなく get(0)())。これは単純な値ではなく、関数です。

仕様書

仕様書
WebAssembly JavaScript Interface
# dom-table-get

ブラウザーの互換性

関連情報

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy