以下是Ts代码:
'''
this.mIndex = 0;
let funUp = function () {
if (Index <= this.mIndex) {
this.unschedule(funUp);
}
}
this.schedule(funUp, newTime);
'''
条件一: 这个this.schedule(funUp, newTime); 是要写到一个继承组件的类的地方.
条件二: 回调函数必须写成 let fun = function {...} 这样,才可以触发 this.unschedule(funDown) 这个,停止循环.
最后标注一下,停止循环 unschedule 传的参数是回调函数,这个很奇特.
网友评论