/**************11111************************/
private timeName: number;
private isCanClick: boolean;
private timeNum: number = 10;
private clickFun(): void {
let s = this;
if (s.isCanClick) {
s.isCanClick = false;
s.timeName = loopMgr.setInterval(s.timeFun, s, 1000);
}
}
private timeFun(): void {
let s = this;
if (s.timeNum <= 0) {
s.clearTime();
return;
}
s.timeNum--;
}
private clearTime(): void {
let s = this;
s.timeNum = 10;
loopMgr.clearInterval(s.timeName);
s.isCanClick = true;
}
/**************222************************/
private timeIdx: number;
private times: number = 10000;
private isCanClick: boolean;
private checkStatus(): boolean {
let s = this;
return s.isCanClick;
}
private clearTime(): void {
let s = this;
if (s.timeIdx)
loopMgr.clearTimeOut(s.timeIdx);
s.timeIdx = null;
}
private timeFun(): void {
let s = this;
s.isCanClick = false;
s.timeIdx = loopMgr.setTimeOut(s.setStatus, s, s.times);
}
private setStatus(): void {
let s = this;
s.isCanClick = true;
s.clearTime();
}
/**************333************************/
private timeIdx: number;
private times: number = 10;
private isCanClick: boolean;
private checkStatus(): boolean {
let s = this;
return s.isCanClick;
}
private clearTime(): void {
let s = this;
if (s.timeIdx)
s.timeIdx = null;
loopMgr.clearInterval(s.timeIdx);
}
private timeFun(): void {
let s = this;
s.isCanClick = false;
s.timeIdx = loopMgr.setInterval(s.setStatus, s, 1000);
/**执行的方法 */
}
private setStatus(): void {
let s = this;
if (s.times <= 0) {
s.clearTime();
s.isCanClick = true;
s.times = 10;
return;
} else {
s.times--;
}
}