Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
javascript
javascript

var mytimer = new pui.Timer();

...

Code Block
javascript
javascript

mytimer.timeout = 600;
mytimer.action = function() { alertconsole.log("HelloRefreshed.") };
mytimer.start();

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.

...

Code Block
javascript
javascript

// Turn off Profound UI's built-in client-side timeout monitoring
pui["client side timeout"] = false;

var timeoutMonitor = {};

timeoutMonitor.timer = new pui.Timer();
timeoutMonitor.timer.resetOnUserActivity = true;
timeoutMonitor.timer.action = function() {
  if (getObj("timeout") != null) pui.click("timeout");
  timeoutMonitor.timer.stop();
  timeoutMonitor.keepalive.stop();
}

timeoutMonitor.keepalive = new pui["Timer"]();
timeoutMonitor.keepalive.action = function() {
  pui["keepAlive"]();
}

timeoutMonitor.start = function() {  // this is called when a screen is rendered
  timeoutMonitor.timer.stop();
  timeoutMonitor.keepalive.stop();
  if (getObj("timeout") == null) return;
  var timeout = getObj("timeout").pui.properties["user defined data"];
  if (timeout == null) return;
  timeout = Number(timeout);
  if (isNaN(timeout) || timeout <= 0) return;
  var keepAliveValue = 600;  // keep Profound UI session alive every 10 minutes
  timeoutMonitor.timer.timeout = timeout;
  //timeoutMonitor.timer.showDebugInfo = true;
  timeoutMonitor.keepalive.timeout = keepAliveValue;
  //timeoutMonitor.keepalive.showDebugInfo = true;
  timeoutMonitor.timer.start();
  timeoutMonitor.keepalive.start();
}

timeoutMonitor.end = function() {  // this is called when a screen is submitted
  timeoutMonitor.timer.stop();
  timeoutMonitor.keepalive.stop();
}

...