File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
src/main/scala/tutorial/webapp Expand file tree Collapse file tree 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.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
@@ -14,4 +16,9 @@ object TutorialApp {
14
16
parNode.appendChild(textNode)
15
17
targetNode.appendChild(parNode)
16
18
}
19
+
20
+ @ JSExportTopLevel (" addClickedMessage" )
21
+ def addClickedMessage (): Unit = {
22
+ appendPar(document.body, " You clicked the button!" )
23
+ }
17
24
}
You can’t perform that action at this time.
0 commit comments