const fs = require('fs')
// 1: Opening inline statement
console.log('1. BEGIN INLINE EXECUTION')
fs.createReadStream('./index.js')
// 2: FS open event
.on('open', () => console.log('2. FILE SYSTEM'))
// 3: FS close event
.on('close', () => console.log('3. CLOSE EVENT'))
.close()
// 4: setImmediate
setImmediate(() => console.log('4. SET IMMEDIATE'))
// 5: setTimeout
setTimeout(() => console.log('5. SET TIMEOUT'), 0)
// 6: setInterval with 0 ttl
setInterval(function () {
console.log('6. SET INTERVAL')
clearInterval(this)
}, 0)
// 7: nextTick
process.nextTick(() => console.log('7. NEXT TICK'))
// 8: Closing inline statement
console.log('8. END INLINE EXECUTION')
'...Entering the Event Loop!...'