Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Stop/Start routing

$
0
0
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.

  1. var appSate = new can.Observe({});

  2. var MyControl = can.Control({
  3. '{state} credentials': function() {
  4. // Here a user logged in or logged out
  5. }
  6. });

  7. var c = new MyControl({ state: appState });

  8. User.login('test', 'user').then(function(user) {
  9. appState.attr('credentials', user);
  10. });

Viewing all articles
Browse latest Browse all 3491

Trending Articles