Commit 69475dc0 authored by Mathieu leclaire's avatar Mathieu leclaire

Get case class from the server

parent 1f3c1a88
......@@ -37,16 +37,17 @@ object Client {
val submitButton2 = button("Click me")(
cursor := "pointer",
onclick := { () =>
Post[Api](_.caseClass(MyCaseClass("Hello !"))).foreach { s =>
caseClassValue() = s
Post[Api](_.caseClass).foreach { s =>
caseClassValue() = s.hello
}
false
}
).render
Rx {
dom.document.body.appendChild(submitButton1)
dom.document.body.appendChild(submitButton2)
Rx {
dom.document.body.appendChild(h1(helloValue).render)
dom.document.body.appendChild(h1(caseClassValue).render)
}
......
......@@ -11,7 +11,7 @@ import scala.concurrent.Await
object Server extends Api {
def hello(a: Int) = a * 3
def caseClass(c: MyCaseClass) = c.oo
def caseClass = MyCaseClass("Hello !")
}
class MyScalatraServlet extends ServertestStack {
......
......@@ -5,12 +5,13 @@ import scala.scalajs.js.annotation.JSExport
class Web extends ClassfileAnnotation
@Web
@JSExport
case class MyCaseClass(oo: String)
case class MyCaseClass(hello: String)
@Web
trait Api {
def hello(a: Int): Int
def caseClass(cc: MyCaseClass): String
def caseClass(): MyCaseClass
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment