Skip to content

Instantly share code, notes, and snippets.

@suguru03
Last active March 29, 2018 17:21
Show Gist options
  • Save suguru03/e05c72b46b0179083140dc8721f22c17 to your computer and use it in GitHub Desktop.
Save suguru03/e05c72b46b0179083140dc8721f22c17 to your computer and use it in GitHub Desktop.
const fs = require('fs');
const path = require('path');
const Event = require('events');
const event = new Event();
setImmediate(() => console.log('setImmediate')); // asynchronous 5
fs.lstat(path.join(__dirname, 'test.js'), () => console.log('fs')); // asynchronous 4
setTimeout(() => console.log('setTimeout')); // asynchronous 3
const interval = setInterval(() => { // asynchronous 3
console.log('setInterval');
clearInterval(interval);
});
Promise.resolve().then(() => console.log('Promise')); // asynchronous 2
process.nextTick(() => console.log('nextTick')); // asynchronous 1
event.on('test', () => console.log('event')); // synchronous
event.emit('test');
// event
// nextTick
// Promise
// setTimeout
// setInterval
// fs
// setImmediate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment