do-async
v0.1.1
Published
Wrapper for serial/parallel asynchronous functions
Downloads
5
Readme
if (!legends){
// skip the next line.
this.pass(["farm", "village", "contenent", "world"]);
}
else{
this.jump(2)();
}
}).then(function(destroyedItems){
alert("Your " + destroyedItems[0]+ " was destroyed by the evil dragon");
var followCalling = confirm("are you ready to become the warrior of legends now?");
if (followCalling){
this.pass()
}
else if (destroyedItems.length <= 1){
this.jump(4)()
}
else{
this.jump(0)(destroyedItems.slice(1))
}
}).then(function(){
alert("you are now training for your encounter with the evil dragon");
var pass = this.pass;
setTimeout(function(){
pass();
}, 5000);
}).then(function(){
this.pass(confirm("armor up?"));
}).then(function(hasEquipment){
if (hasEquipment){
alert("You killed the evil dragon")
}
else{
alert("The evil dragon killed you")
}
}).then(function(hasEquipment){
alert("Game Over");
var again = window.confirm("are you willing to go on an adventure?");
if (again){
this.jump(-3)(true);
}
})
Yes I know about Hoisting. No I dont think ok to use it since I feel it leads to more confusion.