All I need to do is to execute a callback function when my current function execution ends.
function LoadData()
{
alert(\'The data has been loaded\');
function callback(e){
return e;
}
var MyClass = {
method: function(args, callback){
console.log(args);
if(typeof callback == "function")
callback();
}
}
==============================================
MyClass.method("hello",function(){
console.log("world !");
});
==============================================
Result is:
hello world !