Does the event transmitter have to be behind the event monitor?

  node.js, question
var events = require("events")
 var emitter = new events.EventEmitter()
 
 emitter.emit('getPageUrls',4)
 emitter.emit('getPageUrls', 1);
 
 emitter.on("getPageUrls", function(foo){
 console.log(foo);
 })
 
 emitter.emit('getPageUrls',2)
 emitter.emit("getPageUrls", 3)

The output is

2
 3

Is this because of the compilation sequence?

Because emitter implements synchronous event driving, the monitoring defined before emit will only be executed. If emitter inside uses asynchronous event driving, there is less need for sequence.