<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aya Alharazin</title>
    <description>The latest articles on DEV Community by Aya Alharazin (@aya_alharazin).</description>
    <link>https://dev.to/aya_alharazin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3454450%2F5c981727-ce5e-4762-9802-f4d442267519.jpg</url>
      <title>DEV Community: Aya Alharazin</title>
      <link>https://dev.to/aya_alharazin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aya_alharazin"/>
    <language>en</language>
    <item>
      <title>Async VS Event</title>
      <dc:creator>Aya Alharazin</dc:creator>
      <pubDate>Wed, 25 Mar 2026 19:22:19 +0000</pubDate>
      <link>https://dev.to/aya_alharazin/async-vs-event-17h6</link>
      <guid>https://dev.to/aya_alharazin/async-vs-event-17h6</guid>
      <description>&lt;p&gt;At first, Async is about being non-blocking: you start a task and &lt;br&gt;
your program keeps running instead of waiting for it to finish.&lt;br&gt;
Event-driven is about being notified when something specific happens &lt;br&gt;
in the system.&lt;/p&gt;

&lt;p&gt;The key difference is &lt;em&gt;when&lt;/em&gt; the callback runs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In async, the callback executes when a long task finishes 
(e.g., a file is read, a database responds).&lt;/li&gt;
&lt;li&gt;In event-driven, the callback executes when a specific event occurs 
(e.g., a user clicks a button, a message arrives on a queue).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now the question is — what happens inside the event handler? Most of the time, it needs to do some work that takes time (read a file, query a database, call an API). That's exactly where async comes in.&lt;br&gt;
Async Handler Inside an Event&lt;br&gt;
const EventEmitter = require('events');&lt;br&gt;
const emitter = new EventEmitter();&lt;/p&gt;

&lt;p&gt;`// The handler is async — combining both patterns&lt;br&gt;
emitter.on('userSignedUp', async (user) =&amp;gt; {&lt;br&gt;
  try {&lt;br&gt;
    await saveToDatabase(user);        // async work #1&lt;br&gt;
    await sendWelcomeEmail(user);      // async work #2&lt;br&gt;
    console.log('User setup complete');&lt;br&gt;
  } catch (err) {&lt;br&gt;
    console.error('Something went wrong:', err);&lt;br&gt;
  }&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;emitter.emit('userSignedUp', { id: 1, email: '&lt;a href="mailto:ali@example.com"&gt;ali@example.com&lt;/a&gt;' });`&lt;/p&gt;

</description>
      <category>node</category>
    </item>
    <item>
      <title>Greatings</title>
      <dc:creator>Aya Alharazin</dc:creator>
      <pubDate>Wed, 25 Mar 2026 19:04:52 +0000</pubDate>
      <link>https://dev.to/aya_alharazin/greatings-592c</link>
      <guid>https://dev.to/aya_alharazin/greatings-592c</guid>
      <description>&lt;p&gt;Hello everyone , here I will share my understandings of topics , and my learning journey ...&lt;br&gt;
Aya Alharazin 2026&lt;/p&gt;

</description>
      <category>learning</category>
      <category>ai</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
