Results 1 to 4 of 4

Thread: Is there this kind of listener?

  1. #1

    Default Is there this kind of listener?

    Hello, all.

    I've been adding a function to all components and elements to check session status.
    Meanwhile, I've got a question : Is there a listener for all components' and elements' events?
    Because I had to find all the components and elements' event to add the session check function.
    It's too annoying work.

    Any ideas?

    Thanks in advance.
    Stan

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Pass the session timeout value into your page..

    Code:
    <script type="text/javascript">
        MyApp.timeoutValueSeconds = <%=session.getMaxInactiveInterval()%>;
        ...
    </script>
    Then you can start a timeout at app startup for that time.

    And from then on use class level observability on the Ext.data.Connection class to refire the timeout on each Ajax request.

    That way, you can time the client out in synch with the server.

  3. #3
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    You could monitor mousedown/mousemove/keypress events on the body. Only stopped events would not bubble up to the body.

    EventManager can't be monitored, because the essential methods are private, but you could also monitor Observable.fireEvent to catch any Observable event.

    So you would end up with:
    Code:
    var endSession = function(){
            // Do stuff
        },
        endSessionTask = new Ext.util.DelayedTask(endSession),
        delayEndSession = function(){
            endSessionTask.delay(60000);
        };
    Ext.getBody().on({
        mousedown: delayEndSession,
        mousemove: delayEndSession,
        keypress: delayEndSession
    });
    Ext.util.Observable.prototype.fireEvent = Ext.util.Observable.prototype.fireEvent.fireEvent.createInterceptor(delayEndSession);

  4. #4
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Mouse and key events should not interrupt and re-schedule a session timeout.

    The server will timeout regardless of any keyboard or mouse interactions you might be doing, and your next Ajax transaction will fail.

    The client and the server should timeout in sycnhrony.

Similar Threads

  1. Looking for kind of preloading
    By fabads in forum Ext 3.x: Help & Discussion
    Replies: 5
    Last Post: 7 Apr 2010, 7:10 AM
  2. What kind of licence??
    By voinea.alex in forum Community Discussion
    Replies: 2
    Last Post: 21 Jul 2008, 4:08 AM
  3. hi i kind new in this this my question its about forms
    By fastwings in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 10 Jan 2008, 8:26 PM
  4. What kind of commercial licence do we need?
    By janminarik in forum Community Discussion
    Replies: 1
    Last Post: 3 Oct 2007, 1:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •