Can I use jquery done()
on "non-ajax" functions. I get the error Uncaught TypeError: Cannot call method 'done' of undefined
when I try to do something like this.
function countThreeSeconds() {
var counter = 0,
timer = setInterval(function () {
if (counter == 3) {
console.log("All done. That was three seconds.");
window.clearInterval(timer);
} else {
console.log("Not there yet. Counter at: " + counter);
}
counter++;
}, 1000);
}
(function(){
var timer = countThreeSeconds().done(function(){
alert("done");
});
}());
Thanks