WebAssembly.module.imports
这是一项 实验技术
在使用此产品之前,请仔细检查浏览器兼容性表。
WebAssembly.imports()
函数返回一个数组,其中包含给定Module
的所有声明导入的描述。
语法
var custSec = WebAssembly.Module.imports(module);
参数
_module_A WebAssembly.Module
对象。
返回值
包含表示给定模块的导入函数的对象的数组。
异常
如果模块不是WebAssembly.Module
对象实例,则抛出TypeError。
示例
fetch('simple.wasm').then(response =>
response.arrayBuffer()
).then(bytes =>
WebAssembly.compile(bytes)
).then(function(mod) {
var imports = WebAssembly.Module.imports(mod);
console.log(imports[0]);
});
输出如下所示:
{ module: "imports", name: "imported_func", kind: "function" }
规范
Specification | Status | Comment |
---|---|---|
Web Assembly JavaScript APIThe definition of 'imports()' in that specification. | Draft | Initial draft definition. |
浏览器兼容性
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic Support | 57 | 16 | 522 | No | 44 | 11 |
Feature | Android | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
Basic Support | 57 | 57 | (Yes)1 | 522 | No | ? | 11 |
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com