← Back to release summary

WebAssembly Custom Descriptors

Category
WebAssembly
Type
New or changed feature
Status
Proposed (Chrome Proposed)
Intent stage
None

Summary

Allows WebAssembly to store data associated with source-level types more efficiently in new "custom descriptor" objects. These custom descriptors can be configured with prototypes for the WebAssembly objects of that source-level type. This allows methods to be installed on a WebAssembly object's prototype chain and called directly from JS using normal method call syntax. The prototypes and methods can be configured declaratively using an imported builtin function.

Motivation

Without custom descriptors, WebAssembly objects must contain an explicit reference to separate objects containing the data associated with their source-level types, increasing the size of most objects. Furthermore, without the ability to associate JS prototypes with WebAssembly objects via their custom descriptors, it is impossible to call methods on the WebAssembly objects from JS using normal method call syntax. Allowing method calls to work with WebAssembly objects makes it easier and more ergonomic to consume WebAssembly libraries from JS.

Standards & signals

Explainers: https://github.com/WebAssembly/custom-descriptors/blob/main/proposals/custom-descriptors/Overview.md

View on chromestatus.com