Skip to content

Instantly share code, notes, and snippets.

@Alan01252
Created July 10, 2012 12:09
Show Gist options
  • Save Alan01252/3082925 to your computer and use it in GitHub Desktop.
Save Alan01252/3082925 to your computer and use it in GitHub Desktop.
<script>
var test = {
idAccount:121,
idTier:1,
update:function(req,res){
if(typeof(this.idAccount) != 'undefined') {
this.findTier(req,res,function(doc){
req.body.tier = doc.tier;
console.log("1");
});
}
console.log("2");
this.updateTier(req,res);
},
updateTier:function(req,res){
this.idTier = req.body.tier;
},
findTier:function(req,res,callback) {
console.log("Finding tier");
for(var i=0; i < 1000000000; i++){
}
callback({tier:9999});
}
}
var req = {body:{tier:0}};
var res = {};
test.update(req,res);
console.log("Tier is "+test.idTier);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment