(private) new Timings(records)
An instance of a timer can record times with a label associated with it.
Parameters:
Name | Type | Description |
---|---|---|
records |
Object.<Number> | create the timer instance with one or more labels and their timestamp. |
- Source:
Methods
(static) create(records) → {Timings}
Create a new instance of timer. Equivalent to doing new Timer(records:Object.
Parameters:
Name | Type | Description |
---|---|---|
records |
Object.<Number> |
- Source:
Returns:
- Type
- Timings
record(label) → {Number}
Record the current time with the label specified.
Parameters:
Name | Type | Description |
---|---|---|
label |
String |
- Source:
Returns:
- Type
- Number
Example
var t = new Timings();
t.record('start');
console.log(t.toObject()); // logs {start: 1246333 }
toObject() → {Object.<Number>}
Serialise a timing instance to an Object that can then be later used as a source to recreate another timing instance.
- Source:
Returns:
- Type
- Object.<Number>