Skip to content

Instantly share code, notes, and snippets.

@luojiyin1987
Created July 4, 2018 15:06
Show Gist options
  • Save luojiyin1987/24a1c47a5a31fd1109eec9551692bcdb to your computer and use it in GitHub Desktop.
Save luojiyin1987/24a1c47a5a31fd1109eec9551692bcdb to your computer and use it in GitHub Desktop.
#TickFn #callback
let anotherTickFn = x => {
console.log('async', x);
if (x < 10){
process.nextTick(() => {
anotherTickFn(x + 1);
});
}
}
console.log('=== start async ===');
anotherTickFn(1);
console.log('=== end async ===');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment