September 2018
Intermediate to advanced
398 pages
9h 43m
English
By default, Scala.js only creates a JavaScript library with all your dependencies. To make it an application, you have to add the client configuration of the build.sbt file, as shown in the following code:
scalaJSUseMainModuleInitializer := true
Once defined, Scala.js looks for an object containing the main method, as in a normal JVM application. We can create that object in the client/src/main/scala/io/fscala/shopping/client folder. Create a Scala file named UIManager.scala.
In the main function, we would like to log in to the API and initialize the interface with ProductDiv and CartDiv, which we defined earlier, as shown in the following code:
object UIManager { val origin: UndefOr[String] = dom.document.location.origin ...Read now
Unlock full access