Login to follow
Stopwatch

Stopwatch (ODC)

Stable version 0.1.0 (Compatible with ODC)
Uploaded on 20 October 2023 by OutSystems Labs
Stopwatch

Stopwatch (ODC)

Documentation
0.1.0

This asset contains a block that has three input parameters, the uniqueid that identifies the object, the display hours, and the display tenths that allow you to customize what you want to be visible.


         


Basic usage of Stopwatch

Basically with the stopwatch component you can display a stopwatch in your application, with all the functions a normal stopwatch has like start, pause, resume, stop, reset, and get the current time.

The stopwatch component comes with a block that is used to show the time running on the screen, to use it you need to place it inside a container and send the parent container Id to the UniqueId input of the block (we will refer to it just as UniqueId), you can use several stopwatches on the same page as long as the parent container id is different for each of them. Besides that, the other inputs of the block are just two options that enable or disable the ability to show the hours and tenths of seconds.


Start

The start action receives the UniqueId and the StartTime in milliseconds, this action will start the stopwatch either from 0 or from the start time defined as input. You can use it in any of the screen actions as long as you have the stopwatch block on the screen and the action runs after the screen is rendered, this is valid for all the next actions too.

This action works both as a start and a resume.


Pause

The pause action basically does what it says it pauses the stopwatch, there's not much more to talk about it you basically pass the UniqueId as input and it pauses the stopwatch.


Reset

The reset action receives the UniqueId and resets the stopwatch to zero. The reset action also stops the stopwatch so if what you want is to reset the timer without stopping it you should use the Start action and send a StartTime of 0 milliseconds.


IsRunning

That action returns true or false according to whether the stopwatch is currently running or not, it can be useful if you want for example start and pause the stopwatch with the same button, in this case, if the action returns true you would pause or start otherwise (example in the image below).


           


GetTime

This action like the others before receives the UniqueId and returns you the current time of the stopwatch in milliseconds so that you can use it for your purpose.


GetTimeAsString

This action works equal to the previous one with the difference that instead of returning the time as an integer in milliseconds, it is returned as a string formatted as it appears on the screen.