1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
demo: function(callback, delay=2000){ this.status = false; setTimeout(function(){ this.status = true; }, delay); let timer = setInterval(function(){ if(this.status){ clearInterval(timer); delete this.status; if (typeof callback == 'function') { callback(); } } },500); }, |