2

While reading for Javascript Promises, I have come across few blogs/articles where the Promise implementation is first compared with the Javascript Event model and then the callback pattern.

While comparing with the Event model, it is commonly mentioned that ‘it’s possible that the events happened before we started listening for them‘ OR ‘you need to ensure that all appropriate event handlers are added before the first time an event occurs

I’m trying to wrap my head around this and I’m not quite sure howz that possible from code standpoint. How can an event occur before we add the handlers ? Can anyone provide concrete examples to explain this ?