Experimental wrapper to load a WebAssembly program. Returns a list of exported functions. This will probably be moved into it's own package once WebAssembly matures.

wasm(data)

wasm_features()

Arguments

data

either raw vector or file path with the binary wasm program

Details

The wasm_features() function uses the wasm-feature-detect JavaScript library to test which WASM capabilities are supported in the current version of libv8.

Examples

# Load example wasm program
instance <- wasm(system.file('wasm/add.wasm', package = 'V8'))
instance$exports$add(12, 30)
#> [1] 42
wasm_features()
#> $bigInt
#> [1] TRUE
#> 
#> $bulkMemory
#> [1] TRUE
#> 
#> $exceptions
#> [1] TRUE
#> 
#> $extendedConst
#> [1] TRUE
#> 
#> $gc
#> [1] FALSE
#> 
#> $memory64
#> [1] FALSE
#> 
#> $multiValue
#> [1] TRUE
#> 
#> $mutableGlobals
#> [1] TRUE
#> 
#> $referenceTypes
#> [1] TRUE
#> 
#> $relaxedSimd
#> [1] TRUE
#> 
#> $saturatedFloatToInt
#> [1] TRUE
#> 
#> $signExtensions
#> [1] TRUE
#> 
#> $simd
#> [1] TRUE
#> 
#> $streamingCompilation
#> [1] FALSE
#> 
#> $tailCall
#> [1] TRUE
#> 
#> $threads
#> [1] TRUE
#>