Date: 2016-07-01 05:40 pm (UTC)
From: [identity profile] link0ff.livejournal.com
Is Scala.js to Scala like ClojureScript to Clojure?

Date: 2016-07-01 06:51 pm (UTC)
From: [identity profile] juan-gandhi.livejournal.com
I know nothing about ClojureScript (and not much about Clojure).
Here's a tutorial sample:
package com.xxx
import org.scalajs.dom
import dom.document

import scala.scalajs.js.annotation.JSExport
import scala.scalajs.js.{Date, JSApp}

object XXXWebApp extends JSApp {
  def main(): Unit = {
    println("Hello XXX! " + new Date())

    appendPar(document.body, "Hello RXI! it is " + new Date())
  }

  @JSExport
  def addClickedMessage(): Unit = {
    appendPar(document.body, "You clicked the button at " + new Date())
  }

  def appendPar(targetNode: dom.Node, text: String): Unit = {
    val parNode = document.createElement("p")
    val textNode = document.createTextNode(text)
    parNode.appendChild(textNode)
    targetNode.appendChild(parNode)
  }
}


with HTML looking like this:
  <body>
    <script type="text/javascript" src="./target/scala-2.11/rxi-web-client-fastopt.js">
    <script type="text/javascript">
      const GOD = com.rxi.RxiWebApp()
      GOD.main();
    </script>
    <button id="click-me-button" type="button"
            onclick="GOD.addClickedMessage()">Click me!
  </body>

Date: 2016-07-05 09:13 pm (UTC)
From: [identity profile] yussouf.livejournal.com
GWT 2.0?

ггг

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

June 2025

S M T W T F S
1 2345 6 7
8 9 10 11 121314
15161718 1920 21
22232425262728
2930     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 27th, 2025 11:42 am
Powered by Dreamwidth Studios