Skip to content

Instantly share code, notes, and snippets.

@dominykas
Created October 22, 2012 23:46
Show Gist options
  • Save dominykas/3935589 to your computer and use it in GitHub Desktop.
Save dominykas/3935589 to your computer and use it in GitHub Desktop.
.fin() without a .then() breaks ordering
then1
then2
fin1
fin2
fin3
then1
then2
fin3
fin1
fin2
var Q = require("q");
var promise = Q.resolve("ok");
promise
.then(function(v){
console.log("then1");
})
.fin(function(){
console.log("fin1");
})
.end();
promise
.then(function(v){
console.log("then2");
})
.fin(function(){
console.log("fin2");
})
.end();
promise
.fin(function(){
console.log("fin3");
})
.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment