0

我想知道下面的脚本是如何工作的。我正在尝试为每个小时实现一个弹出窗口,以便为用户提供继续的选项,否则它将自动注销。它正在工作,但我怀疑当多个用户登录时会发生什么。当您在您的页面中按注销时,其他人会注销吗?具体来说会

Ext.TaskMgr.stop(taskPoll1);
Ext.TaskMgr.stop(taskPoll);

停止当前脚本的 taskPoll ?

<script>
var counter = 3600;
var counter1 = 20;
var taskPoll = 
{
  run: function()
  {
    counter -= 1;
    if( counter < 1 )
    {
       Ext.TaskMgr.stop(taskPoll);
       countDownComplete();
       return false;
    } 
    else 
    {
    }
 },
 interval:1000
}
    countDownComplete = function()
    {
      var taskPoll1 = 
      {
         run: function()
         {
            counter1 -= 1;
            if( counter1 < 1 )
            {
                Ext.TaskMgr.stop(taskPoll1);
            Ext.TaskMgr.stop(taskPoll);
        //  Ext.TaskMgr.stopAll();
            logout('imagelogout');
            return false;
        } 
            else 
            {
            Ext.MessageBox.updateText('You will be logged out in next <b>' + counter1+' </b> seconds. Please click on  <b> Continue </b> if you do not wish to be logged out.');

            }
    },
    interval:1000
    }
    Ext.MessageBox.maxWidth=420;
    Ext.MessageBox.buttonText.yes = 'Continue';
    Ext.MessageBox.buttonText.no = 'LogOut';
    Ext.MessageBox.confirm('Attention', 'You will be logged out in next 30 seconds. Please click on <b> Continue </b> if you do not wish to be logged out.',
    function(btn)
    {
      if(btn == 'yes')
      {
            counter=3600;
        counter1=20;
        Ext.TaskMgr.stop(taskPoll1);
        Ext.TaskMgr.start(taskPoll);
        return false;
      } 
      else
      {
        Ext.TaskMgr.stop(taskPoll1);
        Ext.TaskMgr.stop(taskPoll);
      //    Ext.TaskMgr.stopAll();
        logout('imagelogout');
        return false;
      }
    }); 
    Ext.TaskMgr.start(taskPoll1);
    }
    // Ext.TaskMgr.start(taskPoll); is the starting point of timeout Pop up
    Ext.TaskMgr.start(taskPoll);
    </script>
4

1 回答 1

1

You are talking about a frontend script which runs locally... And I don't know any site where multiple users stays logged in on a single site, so where is the multiuserproblem?

Talking about scope & tasks: For that case I would recommend you to destroy all all task on logout and create new on start, otherwise you may get problems with still running tasks.

于 2012-09-20T12:30:49.907 回答