agstopwatch

AGStopwatch is built using TypeScript. It's just a basic stopwatch - you can start it, stop it, restart it, and check how much time has elapsed.

AGStopwatch

AGStopwatch is built using TypeScript. It's just a basic stopwatch - you can start it, stop it, restart it, and check how much time has elapsed.

Install using:

npm install agstopwatch

Use it in your code using:

Typescript:

import Stopwatch = require("agstopwatch");

JavaScript:

var Stopwatch = require("agstopwatch");

This is a constructor function. You MUST call it with the new keyword:

var sw = new Stopwatch();

Starts the stopwatch.

Stops the stopwatch.

Clears current start time and restarts the stopwatch.

Clears current start and end time and stops the stopwatch.

The time the stopwatch was started (in ms).

The time the stopwatch was stopped (in ms).

The time elapsed (in ms).

Returns true if the stopwatch is running.