Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Segment

A Segment describes a point in a speedrun that is suitable for storing a split time. This stores the name of that segment, an icon, the split times of different comparisons, and a history of segment times.

Hierarchy

Index

Constructors

constructor

  • This constructor is an implementation detail. Do not use this.

    Parameters

    • ptr: number

    Returns Segment

Properties

ptr

ptr: number

Methods

bestSegmentTime

comparison

  • comparison(comparison: string): TimeRef
  • Accesses the specified comparison's time. If there's none for this comparison, an empty time is being returned (but not stored in the segment).

    Parameters

    • comparison: string

    Returns TimeRef

dispose

  • dispose(): void
  • Disposes the object, allowing it to clean up all of its memory. You need to call this for every object that you don't use anymore and hasn't already been disposed.

    Returns void

iconLen

  • iconLen(): number
  • Accesses the amount of bytes the segment icon's data takes up.

    Returns number

iconPtr

  • iconPtr(): number
  • Accesses the segment icon's data. If there is no segment icon, this returns an empty buffer.

    Returns number

name

  • name(): string
  • Accesses the name of the segment.

    Returns string

personalBestSplitTime

  • Accesses the split time of the Personal Best for this segment. If it doesn't exist, an empty time is returned.

    Returns TimeRef

segmentHistory

with

  • with<T>(closure: (obj: Segment) => T): T
  • Allows for scoped usage of the object. The object is guaranteed to get disposed once this function returns. You are free to dispose the object early yourself anywhere within the scope. The scope's return value gets carried to the outside of this function.

    Type parameters

    • T

    Parameters

    Returns T

Static new

  • Creates a new Segment with the name given.

    Parameters

    • name: string

    Returns Segment

Generated using TypeDoc