Skip to content

Commit

Permalink
Upgrade to sbt-play-scalajs v0.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
hussachai committed Nov 15, 2015
1 parent f618c0a commit e187306
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
8 changes: 4 additions & 4 deletions build.sbt
Expand Up @@ -34,7 +34,6 @@ lazy val exampleClient = (project in file("example-client")).settings(
scalaVersion := scalaV,
persistLauncher := true,
persistLauncher in Test := false,
sourceMapsDirectories += exampleSharedJs.base / "..",
libraryDependencies ++= Seq(
"org.scala-js" %%% "scalajs-dom" % "0.8.1",
"com.lihaoyi" %%% "scalatags" % "0.5.2",
Expand All @@ -47,8 +46,7 @@ lazy val exampleClient = (project in file("example-client")).settings(

lazy val exampleShared = (crossProject.crossType(CrossType.Pure) in file("example-shared")).
settings(scalaVersion := scalaV).
jsConfigure(_ enablePlugins ScalaJSPlay).
jsSettings(sourceMapsBase := baseDirectory.value / "..")
jsConfigure(_ enablePlugins ScalaJSPlay)

lazy val exampleSharedJvm = exampleShared.jvm
lazy val exampleSharedJs = exampleShared.js
Expand All @@ -57,4 +55,6 @@ lazy val exampleSharedJs = exampleShared.js
onLoad in Global := (Command.process("project exampleServer", _: State)) compose (onLoad in Global).value

// for Eclipse users
EclipseKeys.skipParents in ThisBuild := false
EclipseKeys.skipParents in ThisBuild := false
// Compile the project before generating Eclipse files, so that generated .scala or .class files for views and routes are present
EclipseKeys.preTasks := Seq(compile in (exampleServer, Compile))
26 changes: 26 additions & 0 deletions example-client/src/main/scala/example/InteropJS.scala
Expand Up @@ -72,4 +72,30 @@ class Student(firstName: String, val subject: String) extends Person(firstName)
def sayGoodBye(): Unit = js.native

def notExistInJs(): Unit = js.native
}

import org.scalajs.dom._

/**
* A MessageEvent is sent to clients using WebSockets when data is received from the
* server. This is delivered to the listener indicated by the WebSocket object's
* onmessage attribute.
*
* MDN
*/
class MessageEvent extends Event {
def source: Window = js.native

def origin: String = js.native

/**
* The data from the server (`String`, [[Blob]], or `ArrayBuffer`)
*
* MDN
*/
def data: Any = js.native

def initMessageEvent(typeArg: String, canBubbleArg: Boolean, cancelableArg: Boolean, dataArg: js.Any, originArg: String, lastEventIdArg: String, sourceArg: Window): Unit = js.native

def ports: js.Any = js.native
}
4 changes: 2 additions & 2 deletions project/plugins.sbt
Expand Up @@ -11,9 +11,9 @@ resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/release
// Sbt plugins
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.2")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.4")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.5")

addSbtPlugin("com.vmunier" % "sbt-play-scalajs" % "0.2.7")
addSbtPlugin("com.vmunier" % "sbt-play-scalajs" % "0.2.8")

addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.0")

0 comments on commit e187306

Please sign in to comment.