These are chat archives for ractivejs/ractive

17th
Aug 2017
Martin Kolárik
@MartinKolarik
Aug 17 2017 22:12
is there a way to set default @shared data on component/instance level? something like Ractive.extend({ data () { return { val: 1, '@shared.val': 2 } } })
Chris Reeves
@evs-chris
Aug 17 2017 22:15
since @shared is global, it doesn't participate in the hierarchy, so I suppose the answer is 'no'
you can do a check in config and set there, though
the @shared root should probably be exposed somewhere so that you don't have to have an instance to add keys
Martin Kolárik
@MartinKolarik
Aug 17 2017 22:17
yes that was going to be my other question...
I needed to set some values for all instances before but it seems there's no way to do that without creating an instance first
Chris Reeves
@evs-chris
Aug 17 2017 22:18
Ractive.shared would probably be the quickest to implement
there are some assumptions about instances in the runloop that makes it very hard to make observable changes to models without an instance
Martin Kolárik
@MartinKolarik
Aug 17 2017 22:26
I see... I can always create an empty instance just for this. Feels like a hack but works nonetheless.
but Ractive.shared sounds good