Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Matthew Pocock
    @drdozer
    ok thanks - I've found the relevant bit of the sjs documentation
    Marius B. Kotsbak
    @mkotsbak
    ok
    Matthew Pocock
    @drdozer
    I'm using the ACE editor a lot. To hook it into a page, you call ace.edit(elementId) to attach the editor code to the div with that ID.
    So would I have to subclass View and over-ride render(parent, offset) to run the relevant javascript?
    and this will only work if the view is part of the page, so only if when you render a child, the parent is already added to the page
    Matthew Pocock
    @drdozer
    what I really need is an onAddedToPagecallback
    Matthew Pocock
    @drdozer
    OK, I've found a work-around
      override def render(parent: Node,
                          offset: Node) = {
        super.render(parent, offset)
        js.Dynamic.global.window.setTimeout(registerAce _, 0)
      }
    Marius B. Kotsbak
    @mkotsbak
    But it has issues: mkotsbak/widok-scalajs-react-wrapper#1
    Matthew Pocock
    @drdozer
    mm
    Marius B. Kotsbak
    @mkotsbak
    The widgets really should get callbacks when they are added and removed from the dom
    Matthew Pocock
    @drdozer
    I don't think you even need to use much magic for this, right? You just need to propagate it up from the root node when that is added
    Marius B. Kotsbak
    @mkotsbak
    Well when it is added you probably know because it is then constructed
    But when it disappears it is just removed from the dom
    Matthew Pocock
    @drdozer
    I've found this useful:
      implicit class NodeMemoriser[N <: Node](val _n: N) extends AnyVal {
        def rememberAs(f: N => ()): N = {
          f(_n)
          _n
        }
      }
    lets you do things like:
    MyComplicatedWidget(...).rememberAs(widget = _)
    Lets you declare your structure in-place, but write key references to widges into vars so that you can then go back and wire them.
    Matthew Pocock
    @drdozer
    I was wondering if there is a widok quasiquote?
    I have paragraphs of text with keywords and other spans embedded in. It is really ugly to keep on breaking up large, multi-line strings, with closing trebble quotes and stripMargin, then a coma, then the span, then opening the quotes up again.
    Paragraph(
      view"""Some very long
          |bit of text with an ${General.Inline(embedded).css(emphasizeThis)} element,
          |and a ${calculated} value and a $widget inside it.""".stripMargin)
    Matthew Pocock
    @drdozer
    oh, that doesn't work well because stripMargin interacts poorly with interpolation :(
    Matthew Pocock
    @drdozer
    Added #117 with a working implementation
    Mark Kegel
    @littlenag
    are there any large-ish demo apps that have been written with widok?
    i'm thinking something more than say a basic todo list
    i ask because i'm evaluating widok as one of many paths forward for my current side project
    i currently have a front end that's written in plain JavaScript with AngularJS to handle the SPA aspects
    the back end is already Scala, and i would love to have Scala all the way through the app
    Matthew Pocock
    @drdozer
    Hi @littlenag
    I've not built anything horendusly complex with widok
    Mark Kegel
    @littlenag
    have you built anything publically hosted?
    that i could take a look at and learn from?
    Matthew Pocock
    @drdozer
    This is what we're working on at the moment - it's not been optimized in any way, so it is slow and big:
    if you go to one of the tutorials (e.g. http://shortbol.ico2s.org/tutorial.html#/yourFirstScript) there's a 'your turn' box near the bottom. It's implemented with a mix of ace.js and widok.
    Mark Kegel
    @littlenag
    heh, i actually use ace.js as well...
    looking through the code this feels very much like angularjs does
    Mark Kegel
    @littlenag
    @drdozer what is the debugging story like? this is one of the things that angular has really gotten right and i'm wondering what facilities widok offers
    Matthew Pocock
    @drdozer
    to be honest I've not yet hit anyting complicated enough that I couldn't debug it by eye or with a couple of print statements
    you can add loggers to the reactives, which can help
    one thing that bit me early on - don't flatMap over the reactives -- which means no for comprehensions
    Marius B. Kotsbak
    @mkotsbak
    Hmm, bjt
    But flatmap is defined, so what is not working right?
    Matthew Pocock
    @drdozer
    it subscribes the down-stream listener once more for every event fired in the upstream one
    Marius B. Kotsbak
    @mkotsbak
    Hm ok
    I would think that is a bug. Have you added an issue in MetaRx project?
    Matthew Pocock
    @drdozer
    so I've not seen any commits to widok in a little while -- has everyone gone on holiday for the summer?
    I was about to start fleshing out the svg widgets