All Downloads are FREE. Search and download functionalities are using the official Maven repository.

japgolly.webapputil.entrypoint.Entrypoint.scala Maven / Gradle / Ivy

There is a newer version: 2.0.0-RC12
Show newest version
package japgolly.webapputil.entrypoint

import org.scalajs.dom
import scala.scalajs.js.annotation.JSExport

abstract class Entrypoint[Input](final val defn: EntrypointDef[Input]) {

  @JSExport(EntrypointDef.MainMethodName)
  final def main(encodedInput: String): Unit =
    run(decodeInput(encodedInput))

  final def decodeInput(s: String): Input =
    defn.codec.decodeOrThrow(s)

  @inline final protected def `#root` = dom.document.getElementById("root")
  @inline final protected def `#main` = dom.document.getElementById("main")

  def run(i: Input): Unit
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy