Skip to content

Countdown has timer, count, clear features. Test covered 100%.

License

Notifications You must be signed in to change notification settings

dengnan123/count-down-ts

 
 

Repository files navigation

count-down-ts

NPM version Build Status Coverage Status code style: prettier

Countdown has timer, count, clear features. Test covered 100%.

Install

npm

npm install count-down-ts --save

yarn

yarn add count-down-ts --save

bower

bower install count-down-ts --save

Import

ES2015

import countdown from 'count-down-ts'

CommonJS

const countdown = require('count-down-ts')

script

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>DEMO</title>
  </head>
  <body>
    <script type="text/javascript" src="node_modules/count-down-ts/dist/count-down-ts.js"></script>
    <script type="text/javascript">
      var countdown = window.countdown
    </script>
  </body>
</html>

Usage

// init countdown
countdown.start(60, 0, c => console.log(c))

OR

countdown.start()

// cleat countdown setTimeout & count & timer
countdown.clear()

// countdown setTimeout return value
countdown.timer

// countdown current number
countdown.count

accept-expression

countdown.start(count, down, callback)

count: Default 60, type number. Tips: count must greater than down, or equal down.

down: Default 0, type number.

callback: Type (c: number) => void.

LICENSE

GPL v3 License

About

Countdown has timer, count, clear features. Test covered 100%.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 81.9%
  • JavaScript 18.1%