Last active
March 29, 2018 17:21
-
-
Save suguru03/e05c72b46b0179083140dc8721f22c17 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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