function t() {
this.method1 = function(callback) {
// Zorg voor wat vertraging
setTimeout(function() {
if (typeof callback == "function") {
callback();
}
}, 3000);
}
this.method2 = function() {
alert("Done with method1!");
}
}
var obj = new t();
obj.method1(obj.method2);
function t() {
this.method1 = function(callback) {
// Zorg voor wat vertraging
setTimeout(function() {
if (typeof callback == "function") {
callback();
}
}, 3000);
}
this.method2 = function() {
alert("Done with method1!");
}
}
var obj = new t();
obj.method1(obj.method2);