ICEfaces
  1. ICEfaces
  2. ICE-9257

Client-side JavaScript API for user-inactivity detection

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.BETA, 4.0
    • Component/s: Bridge
    • Labels:
      None
    • Environment:
      ICEfaces 3.x
    • Assignee Priority:
      P2
    • Affects:
      Documentation (User Guide, Ref. Guide, etc.), Sample App./Tutorial

      Description

      A useful feature for many applications is to have an application perform an action in response to a prolonged period of user-inactivity in the browser. This may be to force the user to logout, to popup a warning dialog asking if the user requires assistance or more time to complete a transaction.

      This differs from server-side session expiry warnings in that it is based purely on the lack of client-side user activity (mouse moves and button presses, key presses, etc.).

      To support this feature, a new bridge API should be added to allow the configuration of a client inactivity timeout (via ice core:config). When set, a JavaScript callback can be received when the inactivity threshold expires. The application can then use the callback to perform whatever actions it requires based on the inactivity.

      By default, the bridge will not perform any action based on the user-activity timeout other than execute an registered callbacks (the application will have to register a callback in order for anything to occur based on the inactivity timeout).

        Issue Links

          Activity

          Ken Fyten created issue -
          Ken Fyten made changes -
          Field Original Value New Value
          Fix Version/s 3.4 [ 10770 ]
          Assignee Mircea Toma [ mircea.toma ]
          Affects Documentation (User Guide, Ref. Guide, etc.),Sample App./Tutorial [ 10003, 10001 ]
          Assignee Priority P2 [ 10011 ]
          Ken Fyten made changes -
          Link This issue is duplicated by ICE-8138 [ ICE-8138 ]
          Hide
          Mircea Toma added a comment -

          This post describes quite well what is needed to implement this mechanism (of course, YUI is not needed): http://www.nczonline.net/blog/2009/06/02/detecting-if-the-user-is-idle-with-javascript-and-yui-3/

          Show
          Mircea Toma added a comment - This post describes quite well what is needed to implement this mechanism (of course, YUI is not needed): http://www.nczonline.net/blog/2009/06/02/detecting-if-the-user-is-idle-with-javascript-and-yui-3/
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #34996 Mon May 13 15:04:25 MDT 2013 mircea.toma ICE-9257 Implemented user-inactivity detection mechanism.
          Files Changed
          Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/javascript/application.js
          Hide
          Mircea Toma added a comment - - edited

          Implemented user-inactivity detection feature. The feature introduces ice.onUserInactivity function that can be used to register callbacks with. These callbacks will be invoked after the passed in interval of user inactivity has elapsed.

          For example:

          ice.onUserInactivity(45, function() {
             alert('Do you want to save the data you entered?');
          });
          

          The code above registers a callback that will be invoked after 45 seconds of inactivity.

          Show
          Mircea Toma added a comment - - edited Implemented user-inactivity detection feature. The feature introduces ice.onUserInactivity function that can be used to register callbacks with. These callbacks will be invoked after the passed in interval of user inactivity has elapsed. For example: ice.onUserInactivity(45, function () { alert('Do you want to save the data you entered?'); }); The code above registers a callback that will be invoked after 45 seconds of inactivity.
          Mircea Toma made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          Mircea Toma added a comment - - edited

          There are a couple of reasons why the timeout interval is specified when ice.onUserInactivity invoked instead of using icecore:config tag:

          a) The application might choose to alert the user multiple times at different intervals. Maybe an action will need to be taken once the last alert was shown for a while.

          b) Defining the interval in icecore:config makes the configuration disconnected from the actual API use. The application code can always read a parameter or use a value binding to acquire the interval and then register the callback using the interval value.

          Show
          Mircea Toma added a comment - - edited There are a couple of reasons why the timeout interval is specified when ice.onUserInactivity invoked instead of using icecore:config tag: a) The application might choose to alert the user multiple times at different intervals. Maybe an action will need to be taken once the last alert was shown for a while. b) Defining the interval in icecore:config makes the configuration disconnected from the actual API use. The application code can always read a parameter or use a value binding to acquire the interval and then register the callback using the interval value.
          Hide
          Ken Fyten added a comment - - edited

          After reviewing common use-cases, it seems that expanding this feature slightly to also support optional callback notification if a previously idle user becomes active is warranted.

          For example:

          ice.onUserInactivity(45, showIdleDialog(), hideIdleDialog() );
          

          ...would display a dialog when the user goes into the idle state, and hide the dialog if/when the user returned to active status (after first going into an idle state).

          Having both callbacks would enable the type of scenario depicted above, as well as possibly some interesting "background" JS processing that components may perform when the user is deemed to be idle.

          Show
          Ken Fyten added a comment - - edited After reviewing common use-cases, it seems that expanding this feature slightly to also support optional callback notification if a previously idle user becomes active is warranted. For example: ice.onUserInactivity(45, showIdleDialog(), hideIdleDialog() ); ...would display a dialog when the user goes into the idle state, and hide the dialog if/when the user returned to active status (after first going into an idle state). Having both callbacks would enable the type of scenario depicted above, as well as possibly some interesting "background" JS processing that components may perform when the user is deemed to be idle.
          Ken Fyten made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Hide
          Mircea Toma added a comment -

          Modified API and implementation to account for the active user callback.

          Show
          Mircea Toma added a comment - Modified API and implementation to account for the active user callback.
          Mircea Toma made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #35183 Mon May 20 15:56:05 MDT 2013 mircea.toma ICE-9257 Modified API and impementation to account for the active user callback.
          Files Changed
          Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/javascript/user-inactivity.js
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #35184 Mon May 20 15:57:46 MDT 2013 mircea.toma ICE-9257 Execute active user callback only when it exists.
          Files Changed
          Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/javascript/user-inactivity.js
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #35185 Mon May 20 15:58:50 MDT 2013 mircea.toma ICE-9257 Pass in the logger object into the warn method.
          Files Changed
          Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/javascript/user-inactivity.js
          Hide
          Mircea Toma added a comment -
          Show
          Mircea Toma added a comment - Added API docs to the Wiki: http://www.icesoft.org/wiki/display/ICE/JavaScript+Client+API
          Ken Fyten made changes -
          Fix Version/s 4.0 [ 11382 ]
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Mircea Toma
              Reporter:
              Ken Fyten
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: