japgolly / scala-graal

Make usage of Graal features easy and safe from Scala. Also features Scala-based React SSR.
Apache License 2.0
194 stars 4 forks source link

Simple demo #256

Closed bogorman closed 1 year ago

bogorman commented 1 year ago

I have been looking for a simple demo app that I can just compile and run that just calls a scala.js function. I can see your demo code but not a full project. I have put together my own project but I cannot get it to make the call to a function properly. I always get something like Left(japgolly.scalagraal.ExprError$EvalError: ReferenceError: myScalaJsFn1 is not defined)

I can see the functions in the generated Js file though. This is just a simple function passing in and returning a string. If I try and use the Pickled data I see an error about "ScalaGraalBookpicklePickled is not defined". So I just want to get a simple version working.

Any suggestions would be appreciated.

bogorman commented 1 year ago

Got it to work. The scalajs code seems to generate top level exports in an exports namespace. I just added some shims around that to export them at the top level as that seems to be required for ScalaGraalBookpicklePickled.