From f68eae220fbac97454c528600053d75712c94a89 Mon Sep 17 00:00:00 2001 From: Jason Ray Date: Wed, 6 Dec 2023 10:12:02 -0500 Subject: [PATCH] add type definitions --- lib/Stopwatch.d.ts | 25 +++++++++++++++++++++++++ package.json | 1 + 2 files changed, 26 insertions(+) create mode 100644 lib/Stopwatch.d.ts diff --git a/lib/Stopwatch.d.ts b/lib/Stopwatch.d.ts new file mode 100644 index 0000000..421675a --- /dev/null +++ b/lib/Stopwatch.d.ts @@ -0,0 +1,25 @@ +declare class Stopwatch { + constructor(name?: string | boolean, autostart?: boolean, delta?: number); + + start(): void; + stop(): number | null; + restart(): void; + suspend(): number | null; + resume(): void; + split(): number | null; + unsplit(): number | null; + reset(): void; + read(precision?: number, units?: 's' | 'ms'): number | null; + toString(): string; + prettyPrint(): void; + + static STATES: { + INIT: string; + RUNNING: string; + STOPPED: string; + SPLIT: string; + }; +} + +export = Stopwatch; + diff --git a/package.json b/package.json index 71bbfcd..c09c917 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "2.17.2", "description": "statman-stopwatch is one of the metrics from the statman library. It is a simple high res stopwatch for node.js. Stopwatch is useful for determining the amount of time it takes to perform an activity.", "main": "lib/Stopwatch.js", + "types": "Stopwatch.d.ts", "scripts": { "test": "mocha test/" },