Here is my code:
function render(){
var el;
setTimeout(function(){
func();
},1000);
return el;
}
function func(){
//do something here;
}
setTimeout is async, so el will be returned before execute func.I want to return el after calling func, how should I write the callback function?
renderto wait until el is available (as you said el is returned from the function)? If so I'm not sure the @CD answer would work for you.funcare actually triggered at the end offunc