stopwatsch
TypeScript icon, indicating that this package has built-in type declarations

1.4.3 • Public • Published

npm version

Stopwatsch

A simple light weight JavaScript Stopwatch

Installation

To install and set up the library, run:

$ npm install stopwatsch

Getting Started

import stopwatsh from 'stopwatsch';

stopwatsh.start()
setTimeout(() => console.log(stopwatsh.time), 1000) // ≈ 1000

methods

#start()

stopwatsh.start()

Starts the stopwatch

#stop()

stopwatsh.stop()
stopwatsh.pause()

Stops the stopwatch

#restart()

stopwatsh.restart()

Restarts the stopwatch

properties

#milliseconds

stopwatsh.time
stopwatsh.ms
stopwatsh.milliseconds

The elapsed time in milliseconds

#seconds

stopwatsh.s
stopwatsh.sec
stopwatsh.seconds

The elapsed time in seconds

#minutes

stopwatsh.m
stopwatsh.min
stopwatsh.minutes

The elapsed time in minutes

#hours

stopwatsh.h
stopwatsh.hours

The elapsed time in hours

Readme

Keywords

Package Sidebar

Install

npm i stopwatsch

Weekly Downloads

1

Version

1.4.3

License

ISC

Unpacked Size

2.94 kB

Total Files

4

Last publish

Collaborators

  • konkenbonken