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

WebAssembly.Table - WebAssembly | 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 ..

WebAssembly.Table() - JavaScript , WebAssembly. , JavaScript WebAssembly, JavaScript, WebAssembly.

: , .

In this article

WebAssembly.Table()

Table.

Table

Table Table(), Table.

Table.prototype.constructor

. WebAssembly.Table().

Table.prototype.length

( ).

Instance methods

Table.prototype.get(index)

.

Table.prototype.grow(count)

.

Table.prototype.set(index, value)

.

( table2.html) WebAssembly Table 2 . ( 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"

:

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

, wasm (table2.wasm) WebAssembly.instantiateStreaming(). table2.wasm , 42, - 83) 0 1 ( ). , wasm-, , WebAssembly JS.

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)) .

JavaScript, wasm.

Specification
WebAssembly JavaScript Interface
# tables


Web Proxy Viewer  |  New URL  |  Original Page