Socket
Socket
Sign inDemoInstall

react-digital-timer

Package Overview
Dependencies
3
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-digital-timer

![](https://user-images.githubusercontent.com/51183663/204952551-805d512f-a54e-440e-9e6d-49adeec6fc55.png)


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source

React-digital-timer

FunctionalityControl by buttons / keyboard
set up timetype in count down in the timer frame
startPlay button / press Enter
pausePause button / press Enter
resetReset button / ctrl/command + Enter

Installation

Install via NPM

npm i react-digital-timer

Import

import { Timer } from 'react-digital-timer';

Example

import React from 'react';
import ReactDOM from 'react-dom';
import { Timer } from '../dist';
import './App.css';

const INIT_TIME = {
    hour: 0,
    minute: 0,
    second: 624
}

function App() {
    return (
        <div className="App">
            <header className="App-header">
                <p className="App-message">Digital Timer</p>
                <Timer
                    countDownTime={INIT_TIME}
                    onComplete={() => console.log('time\'s up')}
                />
            </header>
        </div>
    );
}

ReactDOM.render(<App />, document.getElementById('root'));

Config Params

FieldTypeDescriptionExample
countDownTimeobjectinitial timer (after reset, the timer will also start with this initial time period){ hour: 0, minute: 20, second: 0 } // 20 minutes
showTimeUpMessagebooleanto enable browser notification when timer count down finishedtrue
disableUpdateByKeyboardbooleanto disable controling timer by keyboard. Enable this config to run a fixed time count downtrue
disableControlPanelbooleanto disable controling timer by buttons (control buttons will be hided)true
digitClassNamestringto customize timer styles by your own CSS classnamelarge-digit (you can find this in the example css file)
iconClassNamestringto customize control button styles by your own CSS classnamelarge-btn (you can find this in the example css file)
onCompletefunctioncallback function fires when timer count down finished() => console.log('time's up')
onTickfunctioncallback function fires during every second's count down(secondsLeft: number) => console.log(secondsLeft)

Credits

Icons downloaded from icons8.com

License

MIT

FAQs

Last updated on 01 Dec 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc