+26
-38
lines changedFilter options
+26
-38
lines changed Original file line number Diff line number Diff line change
@@ -20,16 +20,17 @@ lazy val server = (project in file("server")).settings(
20
20
21
21
lazy val client = (project in file("client")).settings(
22
22
scalaVersion := scalaV,
23
-
persistLauncher := true,
23
+
scalaJSUseMainModuleInitializer := true,
24
24
scalacOptions ++= Seq("-Xmax-classfile-name","78"),
25
-
persistLauncher in Test := false,
25
+
scalaJSUseMainModuleInitializer in Test := false,
26
26
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full),
27
27
libraryDependencies ++= Seq(
28
28
"org.scala-js" %%% "scalajs-dom" % "0.9.1",
29
29
"org.scala-lang.modules" %% "scala-xml" % "1.0.6",
30
30
"com.thoughtworks.binding" %%% "dom" % "11.0.0-M4",
31
31
"com.thoughtworks.binding" %%% "futurebinding" % "11.0.0-M4",
32
-
"fr.hmil" %%% "roshttp" % "2.0.2"
32
+
"fr.hmil" %%% "roshttp" % "2.0.2",
33
+
"io.surfkit" %%% "scalajs-google-maps" % "0.0.3-SNAPSHOT"
33
34
)
34
35
).enablePlugins(ScalaJSPlugin, ScalaJSWeb).
35
36
dependsOn(sharedJs)
@@ -43,3 +44,5 @@ lazy val sharedJs = shared.js
43
44
44
45
// loads the server project at sbt startup
45
46
onLoad in Global := (Command.process("project server", _: State)) compose (onLoad in Global).value
47
+
48
+
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
Original file line number Diff line number Diff line change
@@ -1,46 +1,24 @@
1
1
package example
2
2
3
-
import com.thoughtworks.binding.Binding.Var
4
-
import com.thoughtworks.binding.{Binding, dom}
5
-
import org.scalajs.dom.document
6
-
import org.scalajs.dom.ext.Ajax
7
-
import org.scalajs.dom.raw.{Event, HTMLElement}
8
-
9
-
import scala.scalajs.concurrent.JSExecutionContext.Implicits.queue
3
+
import google.maps.LatLng
4
+
import org.scalajs.dom.{document, window}
10
5
import scala.scalajs.js
11
-
import scala.scalajs.js.JSON
12
-
13
-
14
6
15
7
object ScalaJSExample extends js.JSApp {
16
8
17
-
implicit def makeIntellijHappy(x: scala.xml.Elem): Binding[HTMLElement] = ???
18
-
19
-
/**
20
-
* Ajax Request to server, updates data state with number
21
-
* of requests to count.
22
-
* @param data
23
-
*/
24
-
def countRequest(data: Var[String]) = {
25
-
val url = "http://localhost:9000/count"
26
-
Ajax.get(url).foreach { case xhr =>
27
-
data.value = JSON.parse(xhr.responseText).count.toString
9
+
def main(): Unit = {
10
+
val initialize = js.Function {
11
+
val opts = google.maps.MapOptions(
12
+
center = new LatLng(51.201203, -1.724370),
13
+
zoom = 8,
14
+
panControl = false,
15
+
streetViewControl = false,
16
+
mapTypeControl = false)
17
+
new google.maps.Map(document.getElementById("map-canvas"), opts)
18
+
"" // this function needs a String as return type?!
28
19
}
29
-
}
30
20
31
-
@dom
32
-
def render = {
33
-
val data = Var("")
34
-
countRequest(data) // initial population
35
-
<div>
36
-
<button onclick={event: Event => countRequest(data) }>
37
-
Boop
38
-
</button>
39
-
From Play: The server has been booped { data.bind } times. Shared Message: {shared.SharedMessages.itWorks}.
40
-
</div>
21
+
google.maps.event.addDomListener(window, "load", initialize)
41
22
}
42
23
43
-
def main(): Unit = {
44
-
dom.render(document.body, render)
45
-
}
46
24
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
1
1
@(message: String)
2
2
3
3
@main("Play with Scala.js") {
4
+
<div id="map-canvas"></div>
5
+
4
6
@scalajs.html.scripts("client",
5
7
routes.Assets.versioned(_).toString,
6
8
name => getClass.getResource(s"/public/$name") != null)
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
7
7
<title>@title</title>
8
8
<link rel="stylesheet" media="screen" href="@routes.Assets.versioned("stylesheets/main.css")">
9
9
<link rel="shortcut icon" type="image/png" href="@routes.Assets.versioned("images/favicon.png")">
10
+
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=API_KEY"></script>
10
11
</head>
11
12
<body>
12
13
@content
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1
+
#map-canvas {
2
+
width: 100%;
3
+
height: 800px;
4
+
}
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4