issa-tseng / janus

the two-faced application library-framework.
http://janusjs.org
37 stars 7 forks source link

Automated mechanism to establish bidirectional parent/child view/model/viewmodel relationships #78

Closed issa-tseng closed 5 years ago

issa-tseng commented 7 years ago

Views have explicit hierarchy as a result of the rendered object tree. Often, a child view needs to access some state on its parent view in order to properly function. Until now, the "solution" has been to render the child and then pass oneself down into it, or to generate a tree of bidirectionally linked ViewModel objects and only then render the viewtree based on that.

Instead, some sort of facility should be added to the set of from bindings which is resolved by Views which allows access upward to the closest View, ViewModel, or Model of a particular type or by some other reference method.

This needs to be defined and explored further before implementation. For examples of cases where this fails, look at most things I've ever written in Janus. :)

issa-tseng commented 7 years ago

And maybe also tackle #69 at the same time.

issa-tseng commented 6 years ago

We briefly implemented app.stack() here, and it lived through most of 0.3 and even shipped in 0.4.0. But it was unpleasant as it was the only thing still mandating that app get shadowed at each layer instantiation. This seemed like a poor price to pay in return for a poor solution to this problem, so it was excised.

issa-tseng commented 5 years ago

closing in favor of #137.