UNPKG

@sapphire/stopwatch

Version:
45 lines (43 loc) 1.02 kB
/** * Stopwatch class, uses native node to replicate/extend performance-now dependency. */ declare class Stopwatch { #private; /** * The number of digits to appear after the decimal point when returning the friendly duration. */ digits: number; /** * Starts a new stopwatch */ constructor(digits?: number); /** * The duration of this stopwatch since start or start to end if this stopwatch has stopped. */ get duration(): number; /** * If the stopwatch is running or not. */ get running(): boolean; /** * Restarts the stopwatch (Returns a running state) */ restart(): this; /** * Resets the Stopwatch to 0 duration (Returns a stopped state) */ reset(): this; /** * Starts the Stopwatch */ start(): this; /** * Stops the Stopwatch, freezing the duration */ stop(): this; /** * Defines toString behavior */ toString(): string; } export { Stopwatch };