WebAssembly 可用的函数 [英] Functions available to WebAssembly

查看:24
本文介绍了WebAssembly 可用的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道在现代网络浏览器中运行时可以从 WebAssembly 调用的函数列表?

Does anyone know of a list of functions which are available to call from WebAssembly when running in a modern web browser?

或许答案是,除了 JavaScript 明确提供的函数之外,没有这样的函数?

Or perhaps the answer is that there are no such functions except the ones explicitly made available from JavaScript?

具体来说,我想知道是否可以读取时钟而无需编写调用 Date.getTime() 的 JavaScript,然后从 WebAssembly 调用该 JavaScript.我对该解决方案的问题是,我认为这样做会产生不小的开销,我想经常阅读时钟.最好时钟不会受到本地实时时钟的任何跳跃的影响,因为我只需要测量时间间隔的长度.

Specifically, I would like to know if it is possible to read a clock without the need to write JavaScript that calls Date.getTime() and then call that JavaScript from WebAssembly. My problem with that solution is that I assume doing so would have non-trivial overhead and I would like to read the clock often. Preferably the clock would not be affected by any jump in the local real time clock as I only need to measure the length of time intervals.

推荐答案

您的猜测是正确的:浏览器中没有特定的 Wasm 函数.任何具有 Wasm 理解类型的 JavaScript 函数都可以直接导入到 Wasm 模块中并从其调用.

Your guess is correct: there are no specific Wasm functions in a browser. Any JavaScript function with a type that Wasm understands can be directly imported into and called from a Wasm module.

这篇关于WebAssembly 可用的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆