-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.html
More file actions
97 lines (74 loc) · 2.57 KB
/
Copy pathtimer.html
File metadata and controls
97 lines (74 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
---
layout: default
---
<div class="content">
<h1>Timer</h1>
<p>Timer is a utility class to time events. It is available both on the server and the client.</p>
<p>A timer instance can be used in two ways:
<ul>
<li>Regular Timer
<pre><code class="js">const timer = new Tyr.Timer();
timer.start('initialize database');
<i>... initialize database ...</i>
timer.stop('initialize database');
<i>...</i>
timer.log();
</code></pre>
<li>Stopwatch Timer
<pre><code class="js">const timer = new Tyr.Timer();
<i>... task a ....</i>
timer.lap('task a');
<i>... task b ...</i>
timer.lap('task b');
<i>... task c ...</i>
timer.lap('task c');
<i>...</i>
timer.log();
</code></pre>
</ul>
</article>
<h2 id="eventObject">instance</h2>
<article id="elapsed">
<b class="method"></b>
<b class="server"></b>
<b class="client"></b>
<span class="sig">elapsed(name?: string): number in milliseconds</span>
<p>This returns the total elapsed time for the given timer, or the default total timer if no timer name is given.
</article>
<article id="lap">
<b class="method"></b>
<b class="server"></b>
<b class="client"></b>
<span class="sig">lap(name: string): void</span>
<p>This stops the given timer. If the timer was not started, the timer is considered to have been started when the last
call to <u>lap()</u> was made (or when the timer was created if this is the first <u>lap()</u> call).
</article>
<article id="log">
<b class="method"></b>
<b class="server"></b>
<b class="client"></b>
<span class="sig">log(): void</span>
<p>This logs the current timer status to the console.</p>
</article>
<article id="start">
<b class="method"></b>
<b class="server"></b>
<b class="client"></b>
<span class="sig">start(name?: string): void</span>
<p>This starts a timer with the given name, or if no name is provided, the default total timer.
</article>
<article id="stop">
<b class="method"></b>
<b class="server"></b>
<b class="client"></b>
<span class="sig">stop(name?: string): void</span>
<p>This stops a timer with the given name, or if no name is provided, the default total timer.
</article>
<article id="toString">
<b class="method"></b>
<b class="server"></b>
<b class="client"></b>
<span class="sig">toString(): void</span>
<p>This returns a summary of the current timers.</p>
</article>
</div>