Have been away from CanJS and Javascript in general for a while, but now
back for more. I am trying to understand the best way to maintain a
global 'appstate' observable (sorry: map). I can come up with
several approaches, but I can't decide which one is the most
appropriate when combined with a hierarchy of can.Components.
Ideas:
- create a can.Map in the global can. namespace (can.state) - not a
big fan of this, but I can at least easily understand it.
- bind a can.Map to the topmost DOM element - like it's done in
one of the guides (easy for stache to refer to the global state, but
how can I refer to it from javascript?)
I would like some advise on how to do this. Specifically my
requirement is to have a 'user' object in the state that the
whole app can see/manipulate. I feel like I should be able to solve
this myself, but CanJS changes so much so fast that the
docs/examples/guides can be confusing sometimes.
Thanks.
Michel