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