We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0ec7ca1 commit d55ab22Copy full SHA for d55ab22
build.sbt
@@ -5,3 +5,5 @@ scalaVersion := "2.13.6"
5
6
// This is an application with a main method
7
scalaJSUseMainModuleInitializer := true
8
+
9
+libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "1.2.0"
src/main/scala/tutorial/webapp/TutorialApp.scala
@@ -1,7 +1,16 @@
1
package tutorial.webapp
2
3
+import org.scalajs.dom
4
+import org.scalajs.dom.document
object TutorialApp {
def main(args: Array[String]): Unit = {
- println("Hello world!")
+ appendPar(document.body, "Hello World")
+ }
10
11
+ def appendPar(targetNode: dom.Node, text: String): Unit = {
12
+ val parNode = document.createElement("p")
13
+ parNode.textContent = text
14
+ targetNode.appendChild(parNode)
15
}
16
0 commit comments