倒计时函数封装

define(function(require, exports, module) {

    function Countdown(countButton){
        this.countButton = countButton;
        this.oSendCodeTimer = undefined;
        this.oSendCodeNum = 60;
        this.isStart = false;
        ........
    module.exports =Countdown;
})
define(function(require, exports, module) {

    function Countdown(countButton){
        this.countButton = countButton;
        this.oSendCodeTimer = undefined;
        this.oSendCodeNum = 60;
        this.isStart = false;

        this.start = function(){
            if(this.isStart){
                return;
            }
            this.isStart = true;
            var _this = this;
            this.oSendCodeTimer = setInterval(function() {
                if (_this.oSendCodeNum < 1) {
                    _this.countButton.val('获取验证码');
                    _this.countButton.attr('disabled', false);
                    clearInterval(_this.oSendCodeTimer);
                } else {
                    _this.oSendCodeNum--;
                    _this.countButton.attr('disabled', true);
                    _this.countButton.val(_this.oSendCodeNum + " s");
                };
            }, 1000);
        }

        this.stop = function(){
            if(this.isStart && this.oSendCodeTimer){
                this.oSendCodeNum = 60;
                this.countButton.val('获取验证码');
                clearInterval(this.oSendCodeTimer);
            }
        }
    }
    module.exports =Countdown;
})