Class: TCustomSegment
Defined in: debug/segment-timer.ts:141
Context object for custom segments that can be updated with duration values from external sources.
Constructors
Constructor
new TCustomSegment(
timer,segment):TCustomSegment
Defined in: debug/segment-timer.ts:142
Parameters
timer
segment
TSegment
Returns
TCustomSegment
Methods
createChildSegment()
createChildSegment(
name,durationFunction):TCustomSegment
Defined in: debug/segment-timer.ts:178
Create a child custom segment under this segment.
Parameters
name
string
Name of the child segment
durationFunction
() => number
Function that returns the current duration in milliseconds
Returns
TCustomSegment
A child custom segment
Example
const parentCustom = segmentTimer.createCustomSegment("Update", () => updateTime);
const childCustom = parentCustom.createChildSegment("Physics", () => physicsTime);
// Update both segments
parentCustom.updateDuration();
childCustom.updateDuration();
getSegment()
getSegment():
Readonly<TSegment>
Defined in: debug/segment-timer.ts:188
Get the segment being tracked by this custom segment
Returns
Readonly<TSegment>
updateDuration()
updateDuration():
void
Defined in: debug/segment-timer.ts:151
Update the segment with the current duration from the provided function. This should be called whenever you want to update the segment's timing data.
Returns
void