How to concatenate function calls with timeouts?

Compact syntax with timing methods:

1
2
3
$.wait(first-timeout, function(){  })
  .wait(second-timeout, function(){  })
  .wait(third-timeout, function(){  });

Compare this to the old way with more syntactic fluff:

1
2
3
4
5
6
7
8
9
setTimeout(function(){
  
  setTimeout(function(){
    
    setTimeout(function(){
      
    }, third-timeout);
  }, second-timeout);
}, first-timeout);

Similar patterns with callbacks

Similar patterns with timeouts