Timer Component

The Timer component lets you add time-based rules and logic to your application. For example, a module could include a 10-minute timer for an end-user to confirm an order. If the end-user fails to confirm the order in 10 minutes, the order process resets. In this situation, the time limit might give the end-user a sense of urgency. Also, restarting an idle process could free up resources for other end-users.

Some other uses of the Timer component include:

  • Ensuring an end-user spends enough time on a page.

  • Limiting the amount of time an end-user can stay on a page.

  • Automatically reloading a page when the timer expires.

  • Detecting if an end-user becomes inactive.

Use the Timer component to trigger one or many components when it expires. For example, the Trigger setting fires a single component after the timer expires. You could also trigger other components using use a Decisions component with a Micro Decision of -0, which triggers when the timer reaches 0.

Server-side executed modules do not support the Timer component. For example, if you create a workflow with Task modules, any reference from one module to another in that workflow where a Timer component exists will result in an error.

You'll find the Timer component in the Data & Event Processing group to the left of the Module Builder.

To learn more about the Timer component's settings, click on the tabs below:

Field Text

A static image dispaying the Timer component's Display settings.

Setting

Description

Label Text

Label Text conveys what the input component is and what information it displays. Enter the purpose of the corresponding component or field.

User-friendly labels make your module more accessible. Keep labels short and descriptive (a word or two) using title case. For longer entries, use sentence case.

Contextual Help

Setting

Description

Tooltip

A short hint that displays when an end-user positions their cursor over the Questionmark Icon (Tooltip) icon. Tooltips can display across more than one line.

Helper Text

A quick tip describing the expected value of an input field. Unlike a Tooltip, Helper Text stays visible under the input field and displays on a single line.

Default State Options

Setting

Description

Set Timer Duration

Sets how long the timer runs in seconds.

Timer Direction

Determines if the timer Counts Up to the Timer Duration or Counts Down from the Timer Duration.

Set Timer Format

The Moment.js format for displaying the time remaining. To include words, surround them with square brackets. For example, [Time Remaining] mm:ss.

Reset When User Activity is Detected

When set to  (ON), the component keeps track of end-user's interaction with the screen. If activity is detected, the timer resets. As defined by this setting, activity includes mouse clicks and key presses on the currently focused browser page. Simply moving the mouse is not considered activity.

When set to (OFF), the timer continues for its entire duration regardless of activity on the page.

By default, setting is set to (OFF).

Formatting

Setting

Description

Hide Label

Setting the Hide Label to  (ON) hides Label Text from displaying in Express View. Your Label Text still displays in the Module Builder.

By default, this setting is set to (OFF).

Hide Timer

Shows or hides the component from view. Setting the Hide Timer toggle to  (ON) hides the component in Express View. Setting the toggle to (OFF) unhides the component. The component will always remain visible in the Module Builder.

By default, this setting is set to (OFF).

You can add a Timer component to any page in your Unqork application. For most Timer component configurations, you'll hide the component. Only keep the component visible if the end-user must see the timer.

For this example, the end-user must complete personal information and ensure they sufficient time to complete the Text Area component. The Timer component counts down from 60 seconds. After 60 seconds, a button displays letting your end-user submit their information.

Configure the Text Field Component

1. In the Module Builder, drag and drop a  Text Field component onto your canvas.
2. In the Property ID field, enter name.
3. In the Label Text field, enter Your Name.
4. Click Save Component.

Configure the Text Area Component

1. Drag and drop a Icon Text Area component onto your canvas, placing it below your name  Text Field component.
2. In the Property ID field, enter experience.
3. In the Label Text field, enter Your Experience.
4. Click Save Component.

Configure the Timer Component

1. Drag and drop a  Timer component onto your canvas, placing it below your experience Icon Text Area component.
2. In the Property ID field, enter timerExperience.
3. In the Label Text field, enter timerExperience.
4. Set the Hide Label toggle to  (ON).
5. In the Set Timer Duration field, enter 60.
6. In the Set Timer Format field, enter mm:ss.

A static image displaying the Timer component's configuration settings.

7. Click Save Component.

Configure the Button Component

This Button component displays after the Timer component expires.

1. Drag and drop a Button component Icon Button component onto your canvas, placing it below your timerExperience  Timer component.
2. In the Property ID field, enter btnSubmit.
3. Set the Hide Field toggle to  (ON).
4. Click Save Component.

Configure the Decisions Component

This Decisions component is where you set the rule to only show the Submit button when the timer reaches zero.

1. Drag and drop a Decisions Component icon Decisions component onto your canvas, placing it between your timerExperience  Timer and btnSubmit Button component Icon Button components.
2. In the Property ID and Canvas Label Text fields, enter ruleSixty.
3. Set Trigger Type to Watch.
4. Complete the Inputs table as follows:
 

Source

Alias

Type

1

timerExperience

 

exact

5. Complete the Outputs as follows:
 

Source

Type

1

btnSubmit

visible

6. Complete the Conditionals table as follows:
  timerExperience btnSubmit_visible

1

-0

yes

-0 is the Timer's value only after the time expires. So, this Decisions component only fires when the timer reaches zero.

A static image displaying the Decision Component's configuration settings.

7. Click Save Component.
8. Save your module.

Preview your module in Express View to see the button displaying after the Timer component expires:

Using the example above, execute the Vega Console command UNQENG.tools.getComponentState('timerExperience') in the DevTools Console to display the component's data structure:

A static image displaying the Data Structure of the Timer component in the Dev Tools Console.

The Timer component stores as a key/value pair and displays the current time value in seconds (ss). When viewing a Timer component's value in the Devtools Console, the value displayed is the exact moment the Angular command executes. For example, if a 60-second timer is set to countdown to 0, executing the Angular command at 30 seconds displays a value of 30 in the Console.