Advertisement
enyo

linear-promises

Dec 8th, 2012
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ajaxPromise.post("/bla") // creates and returns a promise
  2. .then(function(result) {
  3.   // Handle result
  4.   return ajaxPromise.get("/bli");
  5. })
  6. .then(function(result2) {
  7.   // Handle result2
  8.   return ajaxPromise.delete("/blo");
  9. })
  10. .then(function(result3) {
  11.   // All done
  12. })
  13. .fail(function(err) {
  14.   // If ANY of those promises fails, catch here
  15. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement