When I try to access Uint8ClampedArray
from code running on the JVM, I get the error: 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.
What JVM library might resolve this run time error?
Do we have other ways to share this data structure across the JS and JVM builds of sbt-crossprojects?
I'm afraid you cannot. Uint8ClampedArray
is a class defined by the JavaScript standard library. It simply does not exist on the JVM.
You might want to look at java.nio.ByteBuffer
for a portable solution, but keep in mind that it doesn't have the clamped behavior of Uint8ClampedArray
. You'll have to wrap in a custom helper if you want that.