Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-interval-timer

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-interval-timer

React Component Wrapper for setTimeout and setInterval.

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
187
increased by58.47%
Maintainers
1
Weekly downloads
 
Created
Source

React Interval Timer

Build Status MIT License

React Component Wrapper for setTimeout and setInterval.

npm install --save react-interval-timer

Usage examples

import IntervalTimer from 'react-interval-timer';

class App extends React.Component {

    render() {
        return (
            <div>
                <IntervalTimer
                    timeout={1000}
                    callback={()=>{console.log("Your function")}}
                    enabled={true}
                    repeat={true}
                />
            </div>
        )
    }
}

export default App;

Run the example app

git clone https://github.com/m-ueta/react-interval-timer.git
cd react-interval-timer
npm install
npm start

then open http://localhost:3000

Options

Props

IntervalTimer.propTypes = {
    timeout: PropTypes.number,
    enabled: PropTypes.bool,
    callback: PropTypes.func,
    repeat: PropTypes.bool
};
IntervalTimer.defaultProps = {
    timeout: 1000,
    enabled: false,
    callback: () => {
        console.log("You need set your callback function for IntervalTimer")
    },
    repeat: true
};
timeout

setTimeout setInterval time

callback

callback function

enabled

Switch timer enable or disable

repeat

switch using setInterval or setTimeout

License

MIT

Keywords

FAQs

Package last updated on 24 Jan 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc