File tree 2 files changed +11
-0
lines changed
src/main/scala/tutorial/webapp
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 5
5
< title > The Scala.js Tutorial</ title >
6
6
</ head >
7
7
< body >
8
+ < button id ="click-me-button " type ="button " onclick ="addClickedMessage() ">
9
+ Click me!
10
+ </ button >
11
+
8
12
<!-- Include Scala.js compiled code -->
9
13
< script type ="text/javascript " src ="./target/scala-2.13/scala-js-tutorial-fastopt/main.js "> </ script >
10
14
</ body >
Original file line number Diff line number Diff line change 1
1
package tutorial .webapp
2
2
3
+ import scala .scalajs .js .annotation .JSExportTopLevel
4
+
3
5
import org .scalajs .dom
4
6
import org .scalajs .dom .document
5
7
@@ -13,4 +15,9 @@ object TutorialApp {
13
15
parNode.textContent = text
14
16
targetNode.appendChild(parNode)
15
17
}
18
+
19
+ @ JSExportTopLevel (" addClickedMessage" )
20
+ def addClickedMessage (): Unit = {
21
+ appendPar(document.body, " You clicked the button!" )
22
+ }
16
23
}
You can’t perform that action at this time.
0 commit comments