summaryrefslogtreecommitdiff
path: root/examples/scala-js/library/src/main/scala/scala/scalajs/js/JSApp.scala
blob: fd12207afae22ca387a5b2ad3f3614faf463a732 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package scala.scalajs.js

import annotation.{JSExport, JSExportDescendentObjects}

/** Base class for top-level, entry point main objects.
 *
 *  Objects inheriting from [[JSApp]] are automatically exported to JavaScript
 *  under their fully qualified name, and their [[main]] method as well.
 *
 *  [[JSApp]] is typically used to mark the entry point of a Scala.js
 *  application. As such, the sbt plugin also recognizes top-level objects
 *  extending [[JSApp]]. It allows to run their [[main]] method with `sbt run`,
 *  and can also generate a tiny JavaScript launcher snippet executing the
 *  [[main]] method of one specific [[JSApp]] object.
 */
@JSExportDescendentObjects
trait JSApp {
  @JSExport
  def main(): Unit
}