npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-time-tracker-stopwatch

v0.0.4

Published

A React and TypeScript based stopwatch for time tracking.

Downloads

1

Readme

react-time-tracker-stopwatch

A React and TypeScript based stopwatch for time tracking.

Installation

npm install --save react-time-tracker-stopwatch
# or
yarn add react-time-tracker-stopwatch

Usage

Styling is not included, but with only three internal elements and a wide array of properties to modify the styling of said elements, this should be fairly simple to work into whatever project.

import * as React from 'react';
import TimeTracker from 'react-time-tracker-stopwatch';

class MyTimer extends React.Component {
  constructor(props, ...args) {
    super(props, ...args);
    this.timeTracker = React.createRef();
  }

  render() {
    return (
      <div>
        <TimeTracker
          onTimeUpdate={(...args) => console.log(args)}
          ref={this.timeTracker}
        >
        <button
          onClick={() => this.timeTracker.current.setTimeTrackerState(0)}
        >
          Reset to 0:00:00 but don't change whether or not the tracker is running.
        </button>
        <button
          onClick={() => this.timeTracker.current.setTimeTrackerState(0, 0)}
        >
          Reset to 0:00:00 but make sure the tracker is running.
        </button>
        <button
          onClick={() => this.timeTracker.current.setTimeTrackerState(0, -1)}
        >
          Reset to 0:00:00 but make sure the tracker is not running.
        </button>
        <button
          onClick={() => this.timeTracker.current.setTimeTrackerState(3600, -1)}
        >
          Reset to 1:00:00 but make sure the tracker is not running.
        </button>
      </div>
    )
  }
}

Props

| Prop | Type | Description | | --------------------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | startText | string? | Text for the control button to start the timer. Defaults to Start. | | stopText | string? | Text for the control button to stop the timer. Defaults to Stop. | | initialValue | number? | The initial value of the timer in seconds. Defaults to 0. | | initialStartTimestamp | number? | The initial starting timestamp of the timer in seconds. If this value is greater than or equal to zero, the timer will automatically be started with the given timestamp. If the value is not provided or is less than zero, the timer will not be started and the starting timestamp will be set to null. | | wrapClass | string? | The class of the div element wrapping the component. Defaults to time-tracker-wrap. | | inputClass | string? | The class of the input element of the component. Defaults to time-tracker-input. | | buttonClass | string? | The class of the button element of the component. Defaults to time-tracker-button. | | wrapStyle | React.CSSProperties? | Inline styles to be passed to the wrapping div element. | | inputStyle | React.CSSProperties? | Inline styles to be passed to the input element of the component. | | buttonStyle | React.CSSProperties? | Inline styles to be passed to the button element of the component. | | onTimeUpdate | (value: number, startTimestamp: number | null) => void | An update handler for the component. Will be called when the time updates. value is the current value of the component in seconds. startTimestamp is the UNIX timestamp of the most recent time the tracker started running in seconds or null if the timer is not running. |

Member Functions

| Function | Signature | Description | | ------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | setTimeTrackerState | (value: number, startTimestamp?: number) => void | A function used to set the value of the time tracker in seconds and control the state of the tracker. The startTimestamp argument can be used to control the running state of the time tracker with the following rules: a number greater than or equal to zero will start the timer with the given startTimestamp, a number less than zero will stop the timer, and undefined (including if no value is passed) will not affect the state of time tracker. |