Skip to content

Latest commit

 

History

History
106 lines (79 loc) · 3.57 KB

general-api.md

File metadata and controls

106 lines (79 loc) · 3.57 KB

API: general methods

Русская версия здесь.

These methods are common and are available both on the server (Node.js) and on the client (in browsers).

.log(value, [comment])

Outputs debugging information to the console. This method returns nothing.

Parameter Type Description
value * A value of any type.
[comment] string Additional explanatory comment to the displayed value.

.rttPoint([name]) ⇒ number

Run-time testing (RTT). Sets the control point in the code. Calculates the code execution time between two control points (in milliseconds). Displays the calculated value in the console.

Returns: number - the calculated value.

Parameter Type Default Description
[name] string Starting point. An optional explanatory name for the control point. The default value is displayed only if the method is called the first time.

.rttStart([name], [levelIndex])

Run-time testing (RTT). The starting point for computing the execution time of some code. This method returns nothing.

Parameter Type Default Description
[name] string An optional explanatory name for this test.
[levelIndex] int 0 An optional index for the level of nesting (for nested tests).

.rttFinish([levelIndex]) ⇒ number

Run-time testing (RTT). The end point for the rttStart() method. Calculates the code execution time between the start and current points (in milliseconds). Displays the calculated value in the console.

Returns: number - the calculated value.

Parameter Type Default Description
[levelIndex] int 0 An optional index for the level of nesting (for nested tests).

Example of nested tests:

Debug.rttStart('The main level.', 0);
Debug.rttStart('The nested level.', 1);
// Some code.
Debug.rttFinish(1);
Debug.rttStart('The nested level.', 1);
// Some code.
Debug.rttFinish(1);
Debug.rttFinish(0);

.rttAverage(codeContainer, cycles, [name], [timeEachIteration]) ⇒ number

Run-time testing (RTT). Calculates the average execution time of some code (in milliseconds). Displays the calculated value in the console.

Returns: number - the calculated value.

Parameter Type Default Description
codeContainer function Container for the code under test.
cycles int Number of cycles to repeat the test (maximum 1000 cycles).
[name] string An optional explanatory name for this test.
[timeEachIteration] boolean false Display the execution time of each iteration?

.stopExec()

The method stops execution of the utility. This method returns nothing.

.resumeExec()

The method resumes execution of the utility. This method returns nothing.