如果(且仅当)未定义 Float32Array JavaScript 类型,完整定义它的最佳方法是什么?
许多 Android 手机和 Windows 平板电脑都会抛出以下错误之一:
- ReferenceError:Float32Array 未定义
- 找不到变量:Float32Array
- Float32Array 不支持
我想要一个没有 jQuery 和其他加号代码的解决方案,如下所示:
https://github.com/inexorabletash/polyfill/blob/master/typedarray.js
谢谢!
最佳答案
我在使用 JavaScript.net 时遇到了同样的错误。
我是这样解决的
context.Run("var self = this; var global;");
using (StreamReader sr = new StreamReader("typedarray.js")) //added typedarray.js (with path)
{
context.Run(sr.ReadToEnd().ToString());
}
关于javascript - 如果未定义则定义 Float32Array,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26951575/