These are chat archives for ractivejs/ractive

3rd
Feb 2018
Chris Reeves
@evs-chris
Feb 03 2018 07:14 UTC
any typescript users here? #3189
Paul Maly
@PaulMaly_twitter
Feb 03 2018 07:27 UTC
@evs-chris Any news about #3178
?
Chris Reeves
@evs-chris
Feb 03 2018 07:30 UTC
if you're good with managing deduping at the individual plugin level, I think #3182 could go ahead
Paul Maly
@PaulMaly_twitter
Feb 03 2018 07:36 UTC
Let’s try it this way and look how it’ll go.
Maybe after you also will be interesting in these features
So, I’m good now
Giannis Koutsaftakis
@kouts
Feb 03 2018 16:33 UTC
Where would be a good place to store a variable that all components of a certain kind have access to?
For example I want all modal components to store info inside a "stack" variable.
I'm currently storing the stack into a variable like this: Ractive._modal_stack
but there must be a more elegant way
right?
Chris Reeves
@evs-chris
Feb 03 2018 16:37 UTC
I've done similar things in the past by assigning each a z-index sorry of number upon creation, registering each with a controller of some sort (Modal.register(this) works), and then having a function that adjusts each registered components z-index each time there is a change (new modal, modal closed, modal raised, etc)
sorry = sort
beyond that, I'd say @shared.modals.stack
Giannis Koutsaftakis
@kouts
Feb 03 2018 16:43 UTC
thanks @evs-chris so when / how to initialize this shared variable?
Chris Reeves
@evs-chris
Feb 03 2018 16:47 UTC
at first modal creation would work
you could also do it when the component is defined using Ractive.shaedSet
sharedSet
so Ractive.extend(...); Ractive.sharedSet('modal.stack', {});
Giannis Koutsaftakis
@kouts
Feb 03 2018 16:50 UTC
wow I didn't even knew that Ractive.sharedSet even existed!
So this way I can create something like a namespace for all modals, right?
Chris Reeves
@evs-chris
Feb 03 2018 16:53 UTC
yep, but it's global inside ractive, so watch out for potential overlap with other things using shared data
double edged sword, and whatnot
Giannis Koutsaftakis
@kouts
Feb 03 2018 16:55 UTC
Ok, I will!