Shabat Closer

Thursday, April 26, 2018

JS : recall function when variable not init

Java Script : recall function when some variable not init


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
var init=false;
function someFunction(){
   if (!init){
      var t=this,f=arguments.callee,a=arguments;
      setTimeout(function(){f.apply(t,a);},100);
      return;
   } 
   console.log("init=",init);
}
someFunction();
init=true;