To use pui.Timer, you must first instantiate it using the new keyword. For example:
Then, you can set the timer’s properties and use its methods: For example:
pui.Timer is available for use in Genie and Rich Display File applications. You can also use it in other environments, such as custom HTML pages or within Atrium, by including the Timer.js script file located in /www/[Instance Name]/htdocs/profoundui/proddata/js.
- timeout - timeout value in seconds
- showDebugInfo - when set to true, shows the elapsed time in the browser's title bar
- checkFrequency - how often to check whether the timeout occurred, specified in milliseconds; default value is 1000
- resetOnUserActivity - when set to true, resets timer if user moves the mouse or uses the keyboard
- start() - starts the timer
- stop() - stops the timer
- reset() - resets the timer
Profound UI has some built-in user/session inactivity timeout features. However, these can be overridden with a custom implementation by setting the pui["client side timeout"] flag to false and creating your own timers.
To be complete, the custom implementation should have something that keeps the server alive by "pinging" it once in a while. This is because the user could be active (moving mouse around or typing) on the screen, but in the meanwhile the server side could time out.
The following example implements custom timeout and keepalive timers for Profound UI applications.
The code looks for a hidden button on your screens with an id of "timeout". This can be bound to a response indicator to let the RPG program know that the screen has timed out. This element should also have the timeout value specified in seconds in the "user defined data" property. When there is no activity, the hidden button is "pressed" by the code.