Commit 84bb8b55 authored by liujiangnan's avatar liujiangnan

feat: 释放定时器

parent 62258fdb
......@@ -274,7 +274,21 @@ cc.Class({
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
_timeoutIds: null,
_intervalIds: null,
// 生命周期
onDestroy() {
this._timeoutIds.forEach(id => {
clearTimeout(id);
});
this._intervalIds.forEach(id => {
clearInterval(id);
});
},
onLoad () {
this._timeoutIds = [];
this._intervalIds = [];
},
ctor() {
this._imageResList = [];
......@@ -386,9 +400,9 @@ cc.Class({
this.sharkNode = null;
}
this.createLetterPage(this.letter);
setTimeout(() => {
this._timeoutIds(setTimeout(() => {
this._enableRestart = true;;
}, 1000);
}, 1000));
// this.loadNextLetter()
// this.updateArrows(this._status.currentStrokeIdx);
// this.onSharkMoveEnd(event, 1);
......@@ -1200,14 +1214,14 @@ cc.Class({
btnNext.opacity = 125;
switch_b2s.opacity = 125;
switch_s2b.opacity = 125;
setTimeout(() => {
this._timeoutIds(setTimeout(() => {
this._disableButtons = false;
btn_restart.opacity = 255;
btnBefore.opacity = 255;
btnNext.opacity = 255;
switch_b2s.opacity = 255;
switch_s2b.opacity = 255;
}, time * 1000);
}, time * 1000));
},
pageFlyOut() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment