Make usage of Graal features easy and safe from Scala. Also features Scala-based React SSR.
APACHE-2.0 License
libraryDependencies ++= Seq(
"com.github.japgolly.scala-graal" %% "core" % "2.0.0"
"com.github.japgolly.scala-graal" %%% "core-js" % "2.0.0"
"com.github.japgolly.scala-graal" %%% "ext-boopickle" % "2.0.0"
"com.github.japgolly.scala-graal" %% "ext-prometheus" % "2.0.0"
)
import japgolly.scalagraal._
// Use semantics and implicit config for JS
// (GraalVM also supports Python, R, Ruby, LLVM)
import japgolly.scalagraal.js._
import GraalJs._
// 1. Pre-compile expression functions for fast invocation.
// 2. Typeclasses translate and/or marshall data between JVM and JS.
val expr: (Int, Int) => Expr[String] =
Expr.apply2((a, b) => s"($a + $b) * 2 + '!'").compile(_.asString)
// Use a basic synchronous JS environment
val ctx = GraalContext()
val result = ctx.eval(expr(3, 8))
assert(result == Right("22!"))
up to 10000 reps/thread & up to 30 sec | until completes within 20ms
)window
and especially window.location
management