WebAssembly.Table.prototype.grow()

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.

The grow() prototype method of the WebAssembly.Table object increases the size of the Table instance by a specified number of elements.

Syntax

table.grow(number);

Parameters

number
The number of elements you want to grow the table by.

Return value

The previous length of the table.

Exceptions

If the grow() operation fails for whatever reason, a RangeError is thrown.

Examples

The following example creates a new WebAssembly Table instance with an initial size of 2 and a maximum size of 10.

var table = new WebAssembly.Table({ element: "anyfunc", initial: 2, maximum: 10 });

You can then grow the table by 1 with the following:

console.log(table.length);   // "2"
console.log(table.grow(1));  // "2"
console.log(table.length);   // "3"

Specifications

Specification Status Comment
Web Assembly JavaScript API
The definition of 'grow()' in that specification.
Draft Initial draft definition.

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 57 15[2] 52 (52)[1] No support 44 11
Feature Chrome for Android Android Webview Edge Mobile Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 57 57 No support 52.0 (52)[1] No support No support 11

[1] WebAssembly is enabled in Firefox 52+, although disabled in the Firefox 52 Extended Support Release (ESR.)

[2] Currently supported behind the “Experimental JavaScript Features” flag. See this blog post for more details.

See also

Document Tags and Contributors

 Contributors to this page: chrisdavidmills, lukewagner, fscholz
 Last updated by: chrisdavidmills,