DEV Community

Cover image for Write your own chainable Event Emitter class for Node and Browser

Write your own chainable Event Emitter class for Node and Browser

Jochem Stoel on December 08, 2018

It is saturday morning, I am still waiting for coffee so let's do something trivial to warm up for the day. Write your own chainable Even...
Collapse
 
justintime4tea profile image
Justin Gross • Edited

Anyone working with event emitters that support wild cards here's a friendly heads up. Don't listen to wild card and in the callback emit any events without some matching on the event... :) Callstack could explode. Be sure to factor in a matcher of sorts which ignores your own emitted messages if emitting from within the wild card callback!