carlw
10/27/2016, 1:52 AMcarlw
10/27/2016, 1:52 AMgtnarg
10/27/2016, 1:54 AMedvin
10/27/2016, 4:46 PMedvin
10/28/2016, 5:56 AMinject()
or find()
. This will be unobtrusive and have a very small footprint and probably easy to understand and reason with. I think we should flag this feature as a beta feature for a while with a warning that the API might change. API-wise it will consist of a variable in component and the parameter to inject()
and find()
. That's basically it. I tried this approach early on but with another mindset so I was never satisfied with it. By accepting that it will not be everything for everyone, and maybe even just a special feature to support JPro and possibly similar frameworks in the future I came to the conclusion that it is "good enough" at least for now. I really need to get back to documentation and screencasts and also the kitchen sink app, so I will try to implement this tomorrow in a feature branch and see how it feels.carlw
10/28/2016, 10:41 AMgtnarg
10/28/2016, 11:40 AMcarlw
10/28/2016, 11:42 AMcarlw
10/28/2016, 11:43 AMcarlw
10/28/2016, 11:44 AMgtnarg
10/28/2016, 12:17 PMgtnarg
10/28/2016, 12:21 PMedvin
10/28/2016, 12:22 PMedvin
10/28/2016, 12:27 PMval myScope = Scope(); val viewInNewScope = find<MyView>(myScope)
edvin
10/28/2016, 12:28 PMViewModel
inside the scope 🙂edvin
10/28/2016, 12:30 PMedvin
10/28/2016, 12:30 PMedvin
10/28/2016, 12:30 PMcarlw
10/28/2016, 1:13 PMcarlw
10/28/2016, 1:14 PMcarlw
10/28/2016, 1:14 PMcarlw
10/28/2016, 1:43 PMcarlw
10/28/2016, 1:44 PMcarlw
10/28/2016, 1:45 PMedvin
10/28/2016, 5:13 PMfind()
inside init or inside the override val root =
expression, you will call find before the framework would have a chance to call component.scope = theScope
. I solved this with a threadlocal, so that the value can be set before newInstance()
is called. This seems to work like a charm.edvin
10/28/2016, 5:14 PMComponent
to support this is this line:edvin
10/28/2016, 5:14 PMedvin
10/28/2016, 5:15 PMfind()
simply calls FX.inheritScopeHolder.set(theScope)
before it instantiates the component. Anybody have a nicer name than inheritScopeHolder
for me? 🙂edvin
10/28/2016, 5:16 PMedvin
10/28/2016, 5:17 PM