Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 21:51

    evs-chris on dev

    safer, though maybe slightly le… minifiable undefineds (compare)

  • Jan 30 2019 20:04
    RustyDev starred ractivejs/ractive
  • Jan 30 2019 10:40

    evs-chris on dev

    fix parent context of component… (compare)

  • Jan 29 2019 08:44
    dashiwa starred ractivejs/ractive
  • Jan 28 2019 21:47

    evs-chris on dev

    fix shuffling when more than on… shuffling binding mystery bug t… don't shuffle an autoshuffling … (compare)

  • Jan 28 2019 19:29
    aligoren starred ractivejs/ractive
  • Jan 28 2019 15:30
    meetajhu starred ractivejs/ractive
  • Jan 27 2019 23:18
    4lm starred ractivejs/ractive
  • Jan 26 2019 10:22
    meetajhu starred ractivejs/ractive
  • Jan 25 2019 22:25

    evs-chris on dev

    fix a few corner cases on autom… (compare)

  • Jan 25 2019 06:22

    evs-chris on dev

    add support for automatically l… (compare)

  • Jan 23 2019 16:37
    frncsdrk starred ractivejs/ractive
  • Jan 20 2019 12:44
    0851 starred ractivejs/ractive
  • Jan 15 2019 15:40
    dagnelies closed #3292
  • Jan 15 2019 15:40
    dagnelies commented #3292
  • Jan 15 2019 15:34
    evs-chris commented #3292
  • Jan 15 2019 15:34
    evs-chris commented #3292
  • Jan 15 2019 15:29
    dagnelies commented #3292
  • Jan 15 2019 15:29
    dagnelies commented #3292
  • Jan 15 2019 15:26
    evs-chris commented #3292
Chris Reeves
@evs-chris
@alexthekid07 you can define custom events that composite multiple dom events together
@leonelcamara there's not really a way to make a context at a particular keypath, as it's a pointer to a place in the template
you can either pass one through or supply extra props to be added to a default instance context (effectively context at the root of the instance template)
Chris Reeves
@evs-chris
@daytonlowell are you running a fairly recent version? iirc, there was a link-related memory leak fixed a few months back
Dayton
@daytonlowell
@evs-chris I'm using a CDN. https://cdn.jsdelivr.net/npm/ractive So I assume that's the latest.
Dayton
@daytonlowell
If anyone feels like seeing the issue, it's running here: https://ithinkwise.com/scorekeeper/
Repo steps are:
  1. add at least 2 players
  2. click start game
  3. click back and forth between the two players at the top.
  4. Eventually, usually after like 15-20 clicks, it will start to chug and become unresponsive.
What's running there is a built with rollup, but it's got source maps set up.
Chris Reeves
@evs-chris
looking...
Dayton
@daytonlowell
<3
changeCurrentScoringPlayer is the function that gets called when you click a player
Dayton
@daytonlowell
I put the project on github in case you want to build it. https://github.com/daytonlowell/score-keeper
Chris Reeves
@evs-chris
...yeah, there's definitely a bug with link that's causing array sizes to blow up hard
Dayton
@daytonlowell
I was afraid that was the case ;-(
Chris Reeves
@evs-chris
I'm guessing the deps are getting added multiple tiems
times*
I'll dig into it after lunch - hopefully won't be too hard to track down, as it's quite a leak
Dayton
@daytonlowell
Thanks so much, Chris!
Chris Reeves
@evs-chris
thanks for the repro!
Chris Reeves
@evs-chris
this is a tricky one, mostly due to some crufty code in ractive
I have a fix for this particular instance, but I'm not positive there's not another way for it to happen
I'll add this to the list of things to look at when paying down some technical debt, but in the meantime, I'm publishing updates to the 1.2 and 1.3 branches
Dayton
@daytonlowell
Thanks @evs-chris
Dayton
@daytonlowell
Is it safe to mark Ractive lifecycle functions as async so you can await Promises within the function?
Chris Reeves
@evs-chris
as long as you're not doing something in them that needs to be in place immediately, like messing with the template in construct, yes
I do async init all the time, and it's wonderfully convenient
Dayton
@daytonlowell
Awesome.
Dayton
@daytonlowell

Also, I think it'd be nice if some instance methods, like toggle resolved with the new value. I'll do stuff like

await ractive.toggle('myBool')
if(ractive.get('myBool')) {
    ractive.find('#myInput').select()
}

but I feel like I should be able to do

if((await ractive.toggle('myBool'))) {
    ractive.find('#myInput').select()
}
Norbert Haberl
@nhaberl
Is there any sample for SPA with any router used ?
Chris Reeves
@evs-chris
I don't know of any samples, but page.js is pretty easy to deal with ractive anchors and dynamic imports
Norbert Haberl
@nhaberl
For switching templates completely or only components ?
I am not that expert in architecting SPA so if there is any reference it would be of real benefit :)
Dayton
@daytonlowell
I use Ractive in a fairly large SPA. I use https://github.com/TehShrike/abstract-state-router with the Ractive Renderer https://github.com/TehShrike/ractive-state-router.
My app isn't open source, unfortunately, but this app uses it https://github.com/TehShrike/inventory-pos
Alex Kozler
@alexthekid07

https://ractive.js.org/plugins/#examples_4

In this example of adding a long-press event I get a weird JS error

Implicit property name must be identifier: 
teardown() {
    node.removeEventListener("mousedown", mouseDownHandler);
    node.removeEventListener("mouseup", mouseUpHandler);
}

It goes away if I change this to:

teardown: function () {
    node.removeEventListener("mousedown", mouseDownHandler);
    node.removeEventListener("mouseup", mouseUpHandler);
}

Is that correct or are the docs wrong?

Chris Reeves
@evs-chris
those are both correct, technically, it's just that the first one is es6 and requires support in either the build tool or target browser depending on how you're working
what is throwing that error? I'd expect most browsers to support that syntax by now
Alex Kozler
@alexthekid07
Sorry, I ended up fixing it. We still support IE11 for the time being and the problem was IE not supporting arrow functions at all. Changing them to non-arrow functions fixed this.
Is there a quick way to add up a sum of an integer from a collection?
I have an array of "conversations" in my ractive data, and they each have an "unread" count. Currently I'm just doing a jquery $.each to loop over them and add "unread" up
But it seems like if the conversation array changes rapidly enough, it screws up the "unread" counting loop and it ends up erroring as the current iteration in the loop has disappeared or changed
Chris Reeves
@evs-chris
your best bet is to add a function to your ractive data to compute the unread count e.g. {{~/unread(.)}} where the unread function is set in the data root and accepts the current user and returns the unread total
Cerem Cem ASLAN
@ceremcem
Hi guys, hi Chris!
Chris Reeves
@evs-chris
Hi! I'm doing much better now. I had an interesting few weeks there though.
Cerem Cem ASLAN
@ceremcem
I'm glad to hear that
Giannis Koutsaftakis
@kouts
I hope all is well now @evs-chris , wish you a speedy recovery!
Chris Reeves
@evs-chris
Thanks!