Skip to content

Instantly share code, notes, and snippets.

@mosluce
Forked from anonymous/123.js
Last active January 11, 2018 01:30
Show Gist options
  • Save mosluce/5f78e4962b874abae76a1e982fee6b06 to your computer and use it in GitHub Desktop.
Save mosluce/5f78e4962b874abae76a1e982fee6b06 to your computer and use it in GitHub Desktop.
console.log(1)
step1(x, function(value1){
console.log(2)
//do something...
step2(y, function(value2){
console.log(3)
//do something...
step3(z, function(value3){
//do something...
console.log(4)
})
console.log(5)
})
console.log(6)
})
console.log(7)
console.log(1)
step1(x, function(value1){
console.log(2)
//do something...
step2(y, function(value2){
console.log(3)
//do something...
step3(z, function(value3){
//do something...
console.log(4)
last(value1, value2, value3);
})
console.log(5)
})
console.log(6)
})
console.log(7)
function last(v1, v2, v3) {
// TODO: what you want.....
}
step1(x, function(v) {
step2wraper(v)
})
function step2wrapper(v1) {
step2(y, function(v2) {
step3wrapper(v1, v2)
})
}
function step3wrapper(v1, v2) {
// v is value2
step3(z, function(v3) {
last(v1, v2, v3)
})
}
function last(v1, v2, v3) {
// TODO: what you want.....
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment