File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
src/main/scala/tutorial/webapp Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -5,3 +5,5 @@ scalaVersion := "2.13.1"
5
5
6
6
// This is an application with a main method
7
7
scalaJSUseMainModuleInitializer := true
8
+
9
+ libraryDependencies += " org.scala-js" %%% " scalajs-dom" % " 1.0.0"
Original file line number Diff line number Diff line change 1
1
package tutorial .webapp
2
2
3
+ import org .scalajs .dom
4
+ import org .scalajs .dom .document
5
+
3
6
object TutorialApp {
4
7
def main (args : Array [String ]): Unit = {
5
- println(" Hello world!" )
8
+ appendPar(document.body, " Hello World" )
9
+ }
10
+
11
+ def appendPar (targetNode : dom.Node , text : String ): Unit = {
12
+ val parNode = document.createElement(" p" )
13
+ val textNode = document.createTextNode(text)
14
+ parNode.appendChild(textNode)
15
+ targetNode.appendChild(parNode)
6
16
}
7
17
}
You can’t perform that action at this time.
0 commit comments