Skip to content
This repository has been archived by the owner on Mar 31, 2018. It is now read-only.

Commit

Permalink
Use the statically typed DOM API.
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrd committed Jun 13, 2014
1 parent 79e2394 commit 6a3c58c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ version := "0.1-SNAPSHOT"
scalaVersion := "2.11.0"

libraryDependencies ++= Seq(
"org.scala-lang.modules.scalajs" %% "scalajs-dom" % "0.4",
"org.scala-lang.modules.scalajs" %% "scalajs-jasmine-test-framework" % scalaJSVersion % "test"
)
6 changes: 3 additions & 3 deletions src/main/scala/example/ScalaJSExample.scala
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package example

import scala.scalajs.js
import js.Dynamic.{ global => g }
import js.annotation.JSExport
import org.scalajs.dom

@JSExport
object ScalaJSExample {
@JSExport
def main(): Unit = {
val paragraph = g.document.createElement("p")
val paragraph = dom.document.createElement("p")
paragraph.innerHTML = "<strong>It works!</strong>"
g.document.getElementById("playground").appendChild(paragraph)
dom.document.getElementById("playground").appendChild(paragraph)
}

/** Computes the square of an integer.
Expand Down

0 comments on commit 6a3c58c

Please sign in to comment.