demo · v141
Custom Descriptors
Compile a small Wasm module (built ahead of time, included as bytes), then inspect the descriptor surface that 141 exposes. With Custom Descriptors enabled, struct types carry an associated JS prototype so methods install directly on the returned objects.
Heads up
Origin trial. Enable
chrome://flags/#enable-experimental-webassembly-features for the full Custom Descriptors surface. Without it, the probe will report partial support and the demo will fall back to plain GC-typed access.
probing WebAssembly + Custom Descriptors…
module surface
click compile to inspect
JS-side prototype
click compile
No call yet.
the WAT (custom descriptors)
;; Source WAT — custom descriptors proposal syntax (illustrative)
(module
(type $Point (descriptor $pointDesc
(struct (field $x f64) (field $y f64))))
(type $pointDesc (descriptor (struct (field $proto externref))))
(func (export "make") (param $x f64) (param $y f64)
(result (ref $Point))
(struct.new $Point (local.get $x) (local.get $y)))
(func (export "distance") (param $p (ref $Point)) (result f64)
(f64.sqrt
(f64.add
(f64.mul (struct.get $Point $x (local.get $p))
(struct.get $Point $x (local.get $p)))
(f64.mul (struct.get $Point $y (local.get $p))
(struct.get $Point $y (local.get $p)))))))
see also
- WebAssembly Custom Descriptors — feature index
- ChromeStatus entry
- Proposal