setInterval的使用和停用

            var res = self.setInterval(function(){
                         if(typeof(UE.getEditor('editor').body.innerHTML) != "undefined"){
                            UE.getEditor('editor').setContent(data.body);
                            clearInterval(res);
                            console.log("填充完毕,停止setInterval循环");
                        }
                        console.log("500ms执行一次,本次已结束了");
                    },500);

var res = self.setInterval(function(){       //console.log("开始填充body到UE.getEditor('editor').body.innerHTML");       //console.log("typeof(UE.getEditor('editor').body.innerHTML)是否已存在:"+typeof(UE.getEditor('editor').body.innerHTML));console.log(new Date().getTime());if(typeof(UE.getEditor('editor').body.innerHTML) != "undefined"){UE.getEditor('editor').setContent(data.body);clearInterval(res);console.log("填充完毕,停止setInterval循环");}console.log("500ms执行一次,本次已结束了");},500);

原文地址:https://www.cnblogs.com/ShanHeDiao/p/5160307.html