Skip to main content
Version: 11.2

$.udb.setTimeout()

note

This article is about the setTimeout() function of the udb object.

$.udb.setTimeout()

Specifies that one or more actions must be performed after a specified idle-time has elapsed. An idle-time is a time interval during which no activity is detected by the server on behalf of the client session.

Depending on the value of the parameter sent, it may return different values.

Syntax

$.udb.setTimeout( *options* )
$.udb.setTimeout( 'off' )
$.udb.setTimeout( 'reset' )
$.udb.setTimeout( 'current' )
$.udb.setTimeout()

*options* ::= {
[minutes]: *idle-time*,
[func]: *idle-function*
}

*idle-time* ::= Integer [15]
*idle-function* ::= { $.udb.showLogin() | }

The .setTimeout() function takes either a specific string value, or options. Options is a struct that may contain the following items. It itself is optional.

The various string values passed to the .setTimeout() function yield the following responses:

ValueDescription
'current'Returns the currently used options in use in a javascript object.
'reset'Resets the currently used options to their default values.
'off'Disables the timeout functionality completely.

Idle-time is an integer that is a number of minutes of idle-time. Idle-time represents the time interval that must pass before idle-function is performed. If idle-time is not specified, the default 15 minutes is applied.

Idle-function is a  function that must be executed after idle-time has elapsed. If idle-function is not specified, the $.udb.showLogin() function is executed.

Example

$.udb.setTimeout({
minutes: 45,
func: function() {
$.udb.executeSQLStatement('login_history')
.then( () => $.udb.commit({quiet: true}) )
.catch( () => $.udb.rollback({quiet: true}) )
.finally( () => {
return $.udb.logout({page: 'PoolAppApplicationStartPage'});
});
}
});

.setTimeout() does not itself trigger the timeout event. It only configures the idle-time interval and the idle-function to run. The timeout event is fired later, and asynchronously, by an internal idle-timer callback that keeps re-arming itself independently of any particular .setTimeout() call, whenever the configured idle time is exceeded. There is no way to trigger timeout programmatically by calling .setTimeout() (or anything else) directly.