Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 12 11:45
    davesmith00000 synchronize #14
  • May 12 10:22
    davesmith00000 opened #14
  • May 13 2018 13:27
    julienrf opened #13
  • Feb 08 2018 12:21
    julienrf commented #12
  • Feb 08 2018 12:21

    julienrf on master

    support input events for input … (compare)

  • Feb 08 2018 12:21
    julienrf closed #12
  • Feb 08 2018 12:19
    battermann edited #12
  • Feb 08 2018 12:16
    battermann synchronize #12
  • Feb 08 2018 12:15
    battermann review_requested #12
  • Feb 08 2018 12:15
    battermann opened #12
  • Feb 05 2018 08:28
    battermann added as member
  • Jan 28 2018 20:20
    julienrf commented #8
  • Jan 28 2018 20:20

    julienrf on master

    elm inspired HTTP API Merge pull request #8 from batt… (compare)

  • Jan 28 2018 20:20
    julienrf closed #8
  • Jan 27 2018 11:11
    battermann synchronize #8
  • Jan 27 2018 11:07
    battermann synchronize #8
  • Jan 26 2018 19:06
    battermann synchronize #8
  • Jan 26 2018 18:51
    battermann synchronize #8
  • Jan 26 2018 08:43
    battermann synchronize #8
  • Jan 25 2018 21:20
    battermann edited #8
Julien Richard-Foy
@julienrf
Hello!
Leif Battermann
@battermann
Hi :)
Leif Battermann
@battermann
hey, how do I get the oninput event from an input element?
Leif Battermann
@battermann
what works, but is really ugly is this:
input(onEvent("keyup", (e: dom.Event) => Input(e.srcElement.asInstanceOf[HTMLInputElement].value)), attr("type", "text"), attr("class", "form-control"), attr("placeholder", "search...")),
Leif Battermann
@battermann
can you give me a short example of how to construct a command that describes an http request? I cannot figure it out, just the constructor. The rest I can put together... it would be a good show case to pitch scalm among my colleagues :)
Julien Richard-Foy
@julienrf
We should add an example about that btw
Julien Richard-Foy
@julienrf
import scalm.{ Task, Cmd }
import org.scalajs.dom.XMLHttpRequest

def httpGet(url: String): Cmd[XMLHttpRequest] =
  Task.RunObservable[XMLHttpRequest, XMLHttpRequest] { observer =>
    val xhr = new XMLHttpRequest
    xhr.open("GET", url)
    xhr.onload = _ => observer.onNext(xhr)
    xhr.onError = _ => observer.onError(xhr)
    xhr.send(null)
    () => xhr.abort()
  }.attempt(_.merge)
The thing is that we need a more elaborate way to build a request (to support all HTTP verbs, entities, etc.) and to decode a response
Leif Battermann
@battermann
Thanks a lot. I will prepare an example.
Leif Battermann
@battermann
My original idea was that commands are pure serializable data structures and that you pass an interpreter to the runtime implementation.
What do you think about that?
Julien Richard-Foy
@julienrf
how would that look like for HTTP requests, for instance?
Leif Battermann
@battermann
I will make an example as soon as I find the time. But it has probably other downsides. E.g. the Cmd trait cannot be sealed then, I guess.
Leif Battermann
@battermann
nvm the interpreter pattern seems not very elmish.
Julien Richard-Foy
@julienrf
well, we don’t have to make an exact copy of elm :)
Leif Battermann
@battermann
sure but at least it has been proven to work quite well
What about some abstractions for http requests? Would you approve of that? And should it be a package within scalm, or a module in a multi module project, or a separate lib? I'd say a package.
Julien Richard-Foy
@julienrf
yeah, sure we should have that
it can be just in a package
Julien Richard-Foy
@julienrf
hello, I’ve just released a 1.0.0-RC1
we can do a 1.0.0 after your HTTP PR is merged if you want
the revision is not that important
but I think 1.0.0 is fine since I’ve been using it for one year
Leif Battermann
@battermann
sounds good
I'd also suggest to add a few more wrappers for HTML tags, like form, p, etc. and maybe a class attribute wrapper as well?