Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    moritz bust
    @busti
    Is it okay to just include an implicit val ctx = Ctx.Owner.save() in my class? I have seen that somewhere...
    But unfortunately .save() lacks documentation.
    moritz bust
    @busti

    In this example:

    class Foo {
      val a = Var(0)
    
      val b = a.fold(1)(_ * _)
    }

    how do I obtain / define / pass an Ownership Context?
    It just is not very clear to me.

    Nick Childers
    @Voltir
    Pass it in as an implicit class param on Foo
    moritz bust
    @busti
    @Voltir But where does that implicit come from? I am not using any rx's elsewhere...
    Nick Childers
    @Voltir
    so, if you have some object:
    object Main {
      val foo = new Foo()
    }
    you will get a context for free
    (magic macro stuff happens to make that possible)
    if you are inside a class, then you can again make that outer class take an implicit ctx
    if you know for sure that Foo (or the class that wraps it) is going to be instantiated a finite number of times, then its safe to use the "unsafe" owner ctx
    moritz bust
    @busti
    That is what I wanted to know, thanks a lot!
    sidnt
    @sidnt
    Weird: I've done import rx._ but my code says not found: value Obs in this code piece for providing the implicit conversion.
    moritz bust
    @busti
    How would I merge two rx's of the same type into a single one, that updates whenever either of the source Rx's updates?
    It's using "scalarx" % "0.2.8", but latest is "0.4.0"
    This is what I got so far:
    implicit def rxFrag[T](r: Rx[T])(implicit dataCtx:  Ctx.Data, ev: T => Frag): Frag = {
        import Ctx.Owner.Unsafe._
    
        def rSafe: dom.Node = span(r()).render
    
        var last = rSafe
        r.triggerLater {
          val newLast = rSafe
          js.Dynamic.global.last = last
          last.parentNode.replaceChild(newLast, last)
          last = newLast
        }
    
        last
      }
    but now even the simplest code requires this implicit Ctx.Data...
    Simon Morgan
    @simon-morgan

    @lihaoyi and other contributors, thank you for an excellent library. I'm more productive and concise than every I was with scalajs-react and scala.binding.

    @lihaoyi will you be at ScalaDays Lausanne in a few weeks? Any one else who uses scala.rx going to be there? It would be great to meet up, discuss experiences and share a drink!! If you are interested, please post!!!

    Kamil Kloch
    @kamilkloch

    Hi! I am struggling with generating table rows wrapped within Rx construct. The following code
    ```scala
    Rx {
    for (row <- rows()) yield tr(...)
    }

    produces a sequence of tr elements wrapped within an extra span. This kills the table column layout. Thanks in advance for any tips!

    Rx {
    for (row <- rows()) yield tr(...)
    }
    Marc Grue
    @marcgrue
    Wrapping a single element should do the trick I think:
    Rx {
      tbody(
        for (row <- rows()) yield tr(...)
      )
    }
    Kamil Kloch
    @kamilkloch
    @marcgrue Thanks :)
    Michal Lacko
    @visox
    hi, any chance for 2.13 ??
    Grant
    @gavares
    +1 ^^. I know macro updates are tough but Scala.rx + scalatags seems like a great pairing to have available
    I’m suffering from a recursion bomb right now with Scala.rx and I’m a bit unclear on Ctx.Owner and Ctx.Data which I suspect are somehow related. I know there are some open tickets related to documentation on that stuff. I’d be more than happy to translate a discussion here into a PR for the docs.