DEV Community

LG
LG

Posted on • Edited on

EventDispatch(er) vs. EventEmitter

Intro

EventTarget interface stands on top of the user-agent (browser), just like the EventEmitter class on top of Node.js or Genetics on top of Human Anatomy , you got the idea . Without Events processes (a process is a very important concept and even a whole module in Node.js context) could not happen . Processes are closely coupled with Signals (in Node.js system calls that works internally via various built-in modules such as file system (fs) module , or child_process module & it’s also recognized as syscalls , which as mentioned in my previous articles – Node.js is closely related to Unix/Linux) . Before getting into specificity , let’s underline a feature common for both user-defined (a.k.a. synthetic) types of event[s] triggered in-advance , instead of waiting for built-in events being triggered within specified condition met to true e.g. submit initiates a client GET/POST request within HTTP server .


EventDispatch(er)

Open the console on codesandbox to see result :

EventEmitter

Press Run (green) button to see in action :

Edge case of .nextTick() to pay extra attention at in Node.js – read more on Nodejs.org/api


Articles to read

Top comments (0)