Skip to content
WASM Analyzer LogoWASM Analyzer LogoWASM Analyzer
GitHub

Exports

In WebAssembly terms, Exports are the functions, tables, memories and globals a Wasm module or component exposes to external code. Module exports are, essentially, Wrappers, containing the various items that need to be exposed to the host environment. Exports from a component add another layer, working as a glue between Wasm and various programming languages, allowing for one way of using Wasm functions in non-JavaScript contexts.





Examples


Accessing exports might look something like this:

WebAssembly.instantiateStreaming(fetch("moduleOrComponent.wasm")).then(
  (obj) => {
    const exported_function = obj.instance.exports.aFunction;
    const exported_table = obj.instance.exports.aTable;
    const exported_memory = obj.instance.exports.memory;
    const exported_global = obj.instance.exports.global;

    // code to use exports goes here
  }
);




Additional reading


Read more about how to use exports in Mozilla’s WebAssembly documentation, here.

You can read about how WebAssembly imports are displayed in the Nor2 WASM Analyzer in the Exports page section of our WASM Analyzer documentation.