I usually make it an Observe that I pass to different Controls to share state information. Much like can.route is an Observe that contains the window hash state.
- var appSate = new can.Observe({});
- var MyControl = can.Control({
- '{state} credentials': function() {
- // Here a user logged in or logged out
- }
- });
- var c = new MyControl({ state: appState });
- User.login('test', 'user').then(function(user) {
- appState.attr('credentials', user);
- });