UNPKG

necessary-utils-core

Version:
34 lines (33 loc) 1.02 kB
/** * ## StopWatch * This class generates a stopwatch so you can find out how long it takes to complete any given action. * You can start, stop, restart and resume this stopwatch at any time. */ export default class StopWatch { private startTime; private endTime; /** * This method returns the total elapsed time by milliseconds. * It returns a 0 value if the stopwatch already never started. */ get elapsedTime(): number; /** * This method is used to start the stopwatch. */ Start(): void; /** * This method stops the stopwatch and returns the total elapsed time by milliseconds. * However, the elapsed time is not reset. * @returns Total Elapsed Time */ Stop(): number; /** * This method stops the stopwatch. * Also, it stops the stopwatch, if the stopwatch currently is running. */ Reset(): void; /** * This method resumes your stopwatch. */ Resume(): void; }