Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function countThreeSeconds() {
- return $.Deferred(function(def){
- var counter = 0,
- timer = setInterval(function () {
- if (counter == 3) {
- console.log("All done. That was three seconds.");
- window.clearInterval(timer);
- def.resolve();
- } else {
- console.log("Not there yet. Counter at: " + counter);
- def.notify(counter);
- }
- counter++;
- }, 1000);
- }).promise();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement