Open
Description
The snippet
interface Function : global.Function {
static FunctionType type(Function func);
};
is not valid WebIDL, and I don't see a clear way to make it so.
Note that it's already possible (though a little tedious) to create a host function from a JS function:
function host_function(f, { parameters, results }) {
const builder = new WasmModuleBuilder();
const functionIndex = builder.addImport("module", "imported", { params: parameters, results });
builder.addExport("exportedFunction", functionIndex);
const buffer = builder.toBuffer();
const module = new WebAssembly.Module(buffer);
const instance = new WebAssembly.Instance(module, {
"module": {
"imported": f,
}
});
return instance.exports.exportedFunction;
}
We could easily introduce this coercion in Table#set() as well, without necessarily introducing this new type.
Metadata
Metadata
Assignees
Labels
No labels