【发布时间】:2018-11-16 19:17:03
【问题描述】:
我编写了一个 C 函数,我可以使用 WebAssembly 从 Angular/TypeScript/JavaScript 执行该函数:
testWebAssembly() {
Module.ccall("aCFunction", null, [], []); // takes a few seconds to finish
}
此函数执行一些繁重的数学计算,需要几秒钟才能完成。当用户点击按钮时触发:
<button (click)="testWebAssembly()">Launch C function</button>
是否可以执行该功能以使其不阻塞 Web 应用程序的 UI?
我试过setTimeOut/async/Promise,但我似乎无法让它工作。
谢谢!
【问题讨论】:
-
你考虑过网络工作者吗?
标签: javascript c angular typescript webassembly