Constructors

  • Instance constructor for use where async instantiation is not possible. Where possible, prefer the static create method over use of this constructor directly as no initialization (feature detection) is able to be done here

    Parameters

    • desiredFeatures: (
          | "bigInt"
          | "bulkMemory"
          | "exceptions"
          | "extendedConst"
          | "gc"
          | "memory64"
          | "multiValue"
          | "mutableGlobals"
          | "referenceTypes"
          | "relaxedSimd"
          | "saturatedFloatToInt"
          | "signExtensions"
          | "simd"
          | "streamingCompilation"
          | "tailCall"
          | "threads"
      )[]

      The desired feature set

    Returns WasmSupport

Properties

desiredFeatures: (
    | "bigInt"
    | "bulkMemory"
    | "exceptions"
    | "extendedConst"
    | "gc"
    | "memory64"
    | "multiValue"
    | "mutableGlobals"
    | "referenceTypes"
    | "relaxedSimd"
    | "saturatedFloatToInt"
    | "signExtensions"
    | "simd"
    | "streamingCompilation"
    | "tailCall"
    | "threads"
)[]

The desired feature set

Accessors

  • get featureSupport(): Readonly<
        Partial<
            Record<
                | "bigInt"
                | "bulkMemory"
                | "exceptions"
                | "extendedConst"
                | "gc"
                | "memory64"
                | "multiValue"
                | "mutableGlobals"
                | "referenceTypes"
                | "relaxedSimd"
                | "saturatedFloatToInt"
                | "signExtensions"
                | "simd"
                | "streamingCompilation"
                | "tailCall"
                | "threads",
                boolean,
            >,
        >,
    >
  • Returns a object containing a property for each desired wasm feature with a boolean value indicating whether or not the feature is supported

    Returns Readonly<
        Partial<
            Record<
                | "bigInt"
                | "bulkMemory"
                | "exceptions"
                | "extendedConst"
                | "gc"
                | "memory64"
                | "multiValue"
                | "mutableGlobals"
                | "referenceTypes"
                | "relaxedSimd"
                | "saturatedFloatToInt"
                | "signExtensions"
                | "simd"
                | "streamingCompilation"
                | "tailCall"
                | "threads",
                boolean,
            >,
        >,
    >

Methods

  • Checks for specific wasm features

    Parameters

    • features: (
          | "bigInt"
          | "bulkMemory"
          | "exceptions"
          | "extendedConst"
          | "gc"
          | "memory64"
          | "multiValue"
          | "mutableGlobals"
          | "referenceTypes"
          | "relaxedSimd"
          | "saturatedFloatToInt"
          | "signExtensions"
          | "simd"
          | "streamingCompilation"
          | "tailCall"
          | "threads"
      )[]

      The list of features to check for

    Returns Promise<boolean>

    True if all the features are supported, false otherwise

  • Static creation & async initialization for use where async instantiation is possible

    Parameters

    • desiredFeatures: (
          | "bigInt"
          | "bulkMemory"
          | "exceptions"
          | "extendedConst"
          | "gc"
          | "memory64"
          | "multiValue"
          | "mutableGlobals"
          | "referenceTypes"
          | "relaxedSimd"
          | "saturatedFloatToInt"
          | "signExtensions"
          | "simd"
          | "streamingCompilation"
          | "tailCall"
          | "threads"
      )[]

      The desired feature set

    Returns Promise<WasmSupport>

    An initialized instance of the class with detection for the desired feature set