🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
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
Version published
Weekly downloads
154
-29.36%
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

react

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