当我尝试从JVM上运行的代码访问Uint8ClampedArray
时,出现错误:java.lang.Error: A method defined in a JavaScript raw type of a Scala.js library has been called. This is most likely because you tried to run Scala.js binaries on the JVM. Make sure you are using the JVM version of the libraries.
哪个JVM库可以解决此运行时错误?
我们还有其他方法可以在sbt-crossprojects的JS和JVM版本之间共享此数据结构吗?
答案 0 :(得分:0)
恐怕你不能。 Uint8ClampedArray
是JavaScript标准库定义的类。它在JVM上根本不存在。
您可能希望查看java.nio.ByteBuffer
的便携式解决方案,但请记住,它没有Uint8ClampedArray
的 clamped 行为。如果需要,您必须使用自定义帮助程序。