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

          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/
          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.
          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.
          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.
          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

            People

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

              Dates

              • Created:
                Updated:
                Resolved: