Skip to content

Instantly share code, notes, and snippets.

@rajikaimal
Last active December 24, 2018 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajikaimal/e35947692a19fbd1f5ea663383ff47d6 to your computer and use it in GitHub Desktop.
Save rajikaimal/e35947692a19fbd1f5ea663383ff47d6 to your computer and use it in GitHub Desktop.
process.nexTick vs setImmediate
const fs = require('fs');
fs.readFile(__filename, () => {
setImmediate(() => {
console.log('SetImmediate callback');
});
process.nextTick(() => { console.log('NextTick callback') })
});
// Output:
// NextTick callback
// SetImmediate callback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment