1.0.3 • Published 7 years ago

countdown-timer-js v1.0.3

Weekly downloads
34
License
MIT
Repository
github
Last release
7 years ago

CountDownTimerJS

CountDownTimerJS - RealTime CountDown Timer JavaScript Library

これは何?

カウントダウンタイマー、JavaScriptライブラリです。

demo

デモページ

Quick start

Clone the repo:

git clone git@github.com:webcyou/countdown-timer-js.git

Install with Bower:

bower install countdown-timer.js

Install with npm:

npm install countdown-timer-js

Basic Usage

<script src="countdown_timer.js"></script>

Basic Format

"hh:mm:ss"

Start DataSet

new CountDownTimer("hh:mm:ss", callBack);

example

new CountDownTimer("12:11:02", function(times, parameters) {
    console.log(times);
});

or

new CountDownTimer("12:11:2", function(times, parameters) {
    console.log(times);
});

or Unix Timestamp (milliseconds)

new CountDownTimer(953994, function(times, parameters) {
    console.log(times);
});

subscribe

let timer = new CountDownTimer("hh:mm:ss");

timer.subscribe(function(times, parameters) {
  ...
});

CallBack

new CountDownTimer(Times, function(times, parameters) {
  ...
});

time

times: string

"hh:mm:ss"

prams: Time

CallBack Parameters Reference

Time Object

ParametersNamevalueDetail
idnumbercreated date Id
splitTimesstring[]hours, minute, second
Hnumberhours
Mnumberminute
Snumberminute
timesstring"hh:mm:ss"
isFinalbooleanTo become true is the one time of 00:00:00 .
createdAtstringTime that was created

Public Function Reference

let timer = new CountDownTimer("hh:mm:ss");
FunctionNamevalueDetail
setTimesstring"hh:mm:ss" change the times
getTimesTimeget the Time Object
getTimesStrstring"hh:mm:ss" get the times
isFinalbooleanTo become true is the one time of 00:00:00
subscribeFunctionsubscribe CallBack function
computeDurationnumber to stringUnix Timestamp (milliseconds) convert to "hh:mm:ss" format

Start develop

npm install
gulp 
Server started http://localhost:8088
LiveReload started on port 35729

Start Test

mocha

gulp mocha

mocha watch

gulp mocha.watch

build Source

gulp dist

Author

Daisuke Takayama Web帳

License

Copyright (c) 2017 Daisuke Takayama Released under the MIT license