elyphas / outwatch-example1

Example with outwatch handler`s

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

run:

$sbt

sbt>reStart

and in the browser http://localhost:8090

shows how the Handler works

  def render: IO[VNode] = for {
                              hdl <- Handler.create[String]
                            } yield {
                              div(
                                label( "Example!" ),
                                input( placeholder := "Introduce your text",
                                  value <-- hdl.map( t => t ),
                                  onChange.target.value.map( t => t) --> hdl
                                ),
                                div( clear.both,
                                  label( "Any event to update the label: ",
                                    hdl.map( t => t )
                                  )
                                )
                              )
                            }


  def main(args: Array[String]): Unit = {

    val app = for {
      r <- render
      _ <- OutWatch.renderInto("#root", r )
    }  yield ()

    app.unsafeRunSync()

  }

About

Example with outwatch handler`s


Languages

Language:Scala 79.0%Language:JavaScript 11.4%Language:CSS 4.4%Language:HTML 4.0%Language:Shell 1.2%