0.2.6 • Published 4 years ago

timer-countdown v0.2.6

Weekly downloads
9
License
MIT
Repository
github
Last release
4 years ago

timer-countdown

timer-countdown is a simple count down timer component using react, which takes time as an input in milliseconds with an optional input of which function to be invoked when the timer completes. Input - 1) time in milliseconds 2) a function passed as props that gets called when the counter is completed 3) a function passed as props that gets called at every tick of a second

Demo

https://stackblitz.com/edit/react-tjdsbw?file=CountdownTimer.css

Installation

yarn add timer-countdown

Usage

import CountdownTimer from 'timer-countdown';
import ReactDOM from 'react-dom';
import React from 'react';

const completed = () => {
  console.log('Timer has completed')
}

const tick = (milliseconds) => {
  console.log(millsieconds);
}

const props = {
 timeLeft : 56000, // time in milliseconds
 completeCallback: completed(), //function to be invoked when the countdown timer finishes
 tickCallback: tick()
}

const Example = () => (
  <div>
    <CountdownTimer {...this.props} />
  </div>
)

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

Development

yarn
yarn dev

Test

yarn test

Build

yarn
yarn build

Publish

npm login
npm version patch
git add -A
git push origin master
npm publish
0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.0

4 years ago

0.1.8

4 years ago

0.1.9

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.5

4 years ago

0.0.6

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.1

4 years ago

0.2.1

4 years ago

0.0.2

4 years ago

0.1.1

4 years ago

0.3.1

4 years ago

0.1.0

4 years ago