title: sproutcore timer usage MaxInactiveInterval
body: <p>Two absolute beginner questions.
  I have working code in my main.js enterState.</p>
  
  <pre><code>enterState: function(context) {
  ..
  //keepAlive
  var now = SC.DateTime.create(); 
  if (now.get('hour') &lt; 18){
      SC.info ("main_state:enterState:go %@", now.get('hour'));
      this.timer = SC.Timer.schedule({
           target: this,
           action: '_timerFired',
           interval: 5000, 
           repeats: YES
          });
      } else {
          SC.info ("MainState:enterState:nogo %@", now.get('hour'));
          };
  ..
      this.mainPane.append();
      },
  
  _timerFired: function(){
          SC.info ("_timerFired %@", Date.now());
      },
  
  
  exitState: function() {
          SC.info('main_state:exitState');
          this.timer.invalidate();
          this.mainPane.remove();             
      },
  </code></pre>
  
  <p>Question 1: the enterState is used every time a user goes to the main view, is the timer schedule initialized once or every time a user switches views?</p>
  
  <p>Question 2: I think I need a query. e.q. the logged in username, to prevent an automatic logout due to the expired session MaxInactiveInterval. Is there sample code to get the spring username in the _timerFired function?</p>
  
  <p>I saw the answer/solution of Maurits, thanks, but it is too complicated for me.</p>