var oResult = document.getElementById('result');
var oStartBtn = document.getElementById('start');
var oPauseBtn = document.getElementById('pause');
var oResetBtn = document.getElementById('reset');

var defaultTime = 10 * 1000;

var countdown = new CountDown({
  time: defaultTime,
  interval: 35,
  onChange(currentTime) {
    oResult.innerText = CountDown.format(currentTime, 'ss:SSS');
  },
  onEnd() {
    oResult.innerText = '倒计时结束!';
  }
});

oResult.innerText = CountDown.format(defaultTime, 'ss:SSS');

oStartBtn.addEventListener('click', () => {
  countdown.start();
});
oPauseBtn.addEventListener('click', () => {
  countdown.pause();
});
oResetBtn.addEventListener('click', () => {
  countdown.reset();
});