[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/WebAssembly/Reference/JavaScript_interface/Table [Back]  [Original]

WebAssembly.Table() - | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

WebAssembly.Table()

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2017 10.

WebAssembly.Table() Table .

, WebAssembly . JavaScript WebAssembly JavaScript WebAssembly .

: function references .

In this article

Syntax

js
var myTable = new WebAssembly.Table(tableDescriptor);

Parameters

tableDescriptor

:_ element _ : . "anyfunc"() .

initial

WebAssembly .

maximum Optional

WebAssembly .

Exceptions

Table instances

Table Table() prototype object . Table .

Instance properties

Table.prototype.constructor

. WebAssembly.Table() .

Table.prototype.length

, .

Instance methods

Table.prototype.get()

- .

Table.prototype.grow()

Table .

Table.prototype.set()

, .

Examples

(table2.html source code live version ) 2 WebAssembly Table . ( Table.prototype.get() . 2 null .

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"

importObj .

js
var importObj = {
  js: {
    tbl: tbl,
  },
};

WebAssembly.instantiateStreaming () wasm (table2.wasm) . table2.wasm ( 42 83 ) 0 1 (text representation ). 2 JS Exported WebAssembly Functions .

js
WebAssembly.instantiateStreaming(fetch("table2.wasm"), importObject).then(
  function (obj) {
    console.log(tbl.length);
    console.log(tbl.get(0)());
    console.log(tbl.get(1)());
  },
);

( : get(0) get(0)()).

wasm .

Specification
WebAssembly JavaScript Interface
# tables

See also


Web Proxy Viewer  |  New URL  |  Original Page