These are chat archives for ractivejs/ractive

9th
Mar 2018
Cerem Cem ASLAN
@ceremcem
Mar 09 2018 00:13
hm. maybe that's the only way to go, like this
Paul Maly
@PaulMaly_twitter
Mar 09 2018 00:20
yep
or just not define x at all.
Cerem Cem ASLAN
@ceremcem
Mar 09 2018 00:24
downside is: if you define bar: undefined, it's broken again: Playground
Paul Maly
@PaulMaly_twitter
Mar 09 2018 00:24
But it's undefined))
it's javascript, man)))
Cerem Cem ASLAN
@ceremcem
Mar 09 2018 00:25
:))
Chris Reeves
@evs-chris
Mar 09 2018 00:43
I mean, if you don't mind getting a little funky with internals
that's theoretically future-proof
Cerem Cem ASLAN
@ceremcem
Mar 09 2018 00:45
:tada:
would you consider including it to ractive by default?
Chris Reeves
@evs-chris
Mar 09 2018 00:47
probably not as it stands... there's probably more to consider when bringing into core, but when @fskreuz finishes that sweet, sweet monorepo, it would make a reasonable addition
along with taking some current stuff in core out
a template manipulation API would be a nice thing
Paul Maly
@PaulMaly_twitter
Mar 09 2018 00:52
The power of custom plugins in action!
Cerem Cem ASLAN
@ceremcem
Mar 09 2018 12:09
@evs-chris is there any known problems with edge? you've said something about edge build some time ago, AFAIR. I want to follow the edge, if there is no known drawbacks
Cerem Cem ASLAN
@ceremcem
Mar 09 2018 13:15
btw, I needed this JSON edit component a lot, maybe anyone wants to use too: https://github.com/ceremcem/ractive-components/blob/master/README.md#json-edit
Chris Reeves
@evs-chris
Mar 09 2018 15:26
there are no problems per se
it does get breaking changes occasionally, but it can't be published unless all of the tests pass
Cerem Cem ASLAN
@ceremcem
Mar 09 2018 15:29
okay, I'm following the edge for now
another question: is this the way to go if we want to observe some branches of an object:
        paths = ['foo.x', 'foo.y']
        for(p in paths){
            this.observe(paths[p], function(value){
                this.add('count', 1)
            })
        }
Chris Reeves
@evs-chris
Mar 09 2018 15:36
just some, or all?
for the former, 'foo.x foo.y'
the latter, 'foo.*'
multiple paths can be subscribed in one observer by putting spaces between the paths
this includes wildcards and is why you get the keypath as the third arg
kouts
@kouts
Mar 09 2018 17:57
How many observers till one hits perf wall?
Chris Reeves
@evs-chris
Mar 09 2018 18:10
haven't hit it yet
kouts
@kouts
Mar 09 2018 18:11
couple of hundreds?
Chris Reeves
@evs-chris
Mar 09 2018 18:11
if they're spread a around the model, should be no problem
kouts
@kouts
Mar 09 2018 18:11
I try to avoid them that's why I ask
I always thought they had a huge perf impact
Chris Reeves
@evs-chris
Mar 09 2018 18:12
observer has just a tiny bit more overhead than a mustache
pattern observers a bit more expensive, but not awfully so
kouts
@kouts
Mar 09 2018 18:12
@evs-chris what does it mean "if they're spread a around the model"?
Chris Reeves
@evs-chris
Mar 09 2018 18:34
not all on the same keypath or parent keypath
kouts
@kouts
Mar 09 2018 18:48
I see, thanks!
Cerem Cem ASLAN
@ceremcem
Mar 09 2018 18:59
@evs-chris what I want to observe is not all, but some separate paths
then space character is the solution here. but I would expect ractive.observe to accept an array for multiple path observation
Chris Reeves
@evs-chris
Mar 09 2018 19:33
I'm not sure exactly why it doesn't, but on and observe have always been like that :smile:
Cerem Cem ASLAN
@ceremcem
Mar 09 2018 19:49
hmm... I now have an idea of the reason after opening an issue (as always): https://github.com/ractivejs/ractive/issues/3210#issuecomment-371925964
(am I the only one who finds the answers right after asking in stackoverflow, github issues, etc.?)
Paul Maly
@PaulMaly_twitter
Mar 09 2018 19:51
ractive.observe(keypaths.join(' '), () => {});
Chris Reeves
@evs-chris
Mar 09 2018 19:52
that's the best way :grinning:
Paul Maly
@PaulMaly_twitter
Mar 09 2018 19:53
if you need to store keypaths in array or receive from somewhere
Chris Reeves
@evs-chris
Mar 09 2018 19:53
sometimes google just can't work until you've posted the question
Paul Maly
@PaulMaly_twitter
Mar 09 2018 19:55
new search engine algorithm? )))
Cerem Cem ASLAN
@ceremcem
Mar 09 2018 19:56
the shortest duration of an issue life, ever :D
Paul Maly
@PaulMaly_twitter
Mar 09 2018 19:57
good to statistics :smile:
Tagline of a day: "Ractive - your issues already solved before you knew about them"
Cerem Cem ASLAN
@ceremcem
Mar 09 2018 19:59
:DDD
Joseph
@fskreuz
Mar 09 2018 20:04
I'd like to believe @Rich-Harris comes from the future and/or can read minds.
Chris Reeves
@evs-chris
Mar 09 2018 20:11
I still have that theory about blue police boxes in NYC
Rich Harris
@Rich-Harris
Mar 09 2018 21:06
shhh you're gonna blow my cover