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

WebAssembly.Table - WebAssembly | MDN

MDN Web Docs

View in English Always switch to English

WebAssembly.Table

201710

WebAssembly.Table JavaScript WebAssembly Table JavaScript WebAssemble Table JavaScript WebAssembly

Table

WebAssembly.Table()

Table

Table.prototype.length

Table

Table.prototype.get()

Table.prototype.grow()

Table

Table.prototype.set()

WebAssembly Table

table2.html WebAssembly Table 2 Table.prototype.get() 2 null

js
const 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"

Table

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

WebAssembly.instantiateStreaming() Wasm table2.wasmtable2.wasm 42 83 Table 0 1 2 WebAssembly JS

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

get(0)() get(0)

JavaScript Table Wasm Table

WebAssembly JavaScript Interface
# tables


Web Proxy Viewer  |  New URL  |  Original Page