Skip to content

Instantly share code, notes, and snippets.

@ABCxFF
ABCxFF / wasmfunc.polyfill.js
Created February 25, 2024 03:44
async WebAssembly.Function polyfill
// For Firefox or other browsers that don't provide WebAssembly.Function APIs,
// this polyfill, albeit async, can be used as a substitute.
//
// Using WASM, this polyfill is accepted by WebAssembly.Tables, and can be inserted
// into them without failure
if (!WebAssembly.Function) {
const vu32 = (x) => {
let out = [];
do {
let byte = x & 0x7F;