<?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: Muedgar</title>
    <description>The latest articles on DEV Community by Muedgar (@muedgar).</description>
    <link>https://dev.to/muedgar</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%2F218694%2F12c2a521-cd9e-4d9d-a4a5-22726e4f2eb4.jpeg</url>
      <title>DEV Community: Muedgar</title>
      <link>https://dev.to/muedgar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/muedgar"/>
    <language>en</language>
    <item>
      <title>Events in node.js</title>
      <dc:creator>Muedgar</dc:creator>
      <pubDate>Sun, 24 Jul 2022 22:26:00 +0000</pubDate>
      <link>https://dev.to/muedgar/events-in-nodejs-1246</link>
      <guid>https://dev.to/muedgar/events-in-nodejs-1246</guid>
      <description>&lt;p&gt;&lt;strong&gt;Content:&lt;/strong&gt;&lt;br&gt;
**1.Introduction about events in node.js&lt;br&gt;
2.Example of using events in node.js&lt;/p&gt;

&lt;p&gt;1.Introduction about events in node.js**&lt;/p&gt;

&lt;p&gt;&lt;em&gt;1.1.EventEmitter class and events inbuilt module provided by node.js&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Events inbuilt module in node.js contains an EventEmitter class, that can be extended by other classes to use many of its methods. EventEmitter class calls two methods to add and remove events.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;1.2.EventEmitter class methods&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;EventEmitter class has a method called "on" that takes in the name of the event as the first argument and the event callback function as the second argument.&lt;/p&gt;

&lt;p&gt;The event callback function:&lt;/p&gt;

&lt;p&gt;function syntax: when "this" is an argument it refers to the EventEmitter instance&lt;/p&gt;

&lt;p&gt;arrow syntax: when "this" is an argument it refers to an empty object&lt;/p&gt;

&lt;p&gt;EventEmitter class has a method called "emit" that takes in the name of the event to fire or trigger as the first argument and the following parameters as arguments to the callback function.&lt;/p&gt;

&lt;p&gt;2.&lt;br&gt;
&lt;strong&gt;The eventemitter class: examples&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const {EventEmitter} = require("events");

class EventEmitterClass extends EventEmitter {
    constructor() {
        super();
    }
}

module.exports = {EventEmitterClass};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set of examples to use the eventemitter class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const {EventEmitterClass} = require("./eventEmitter");

const myEmitter = new EventEmitterClass();
myEmitter.on('event', (a, b) =&amp;gt; {
  console.log(a,b);
  setImmediate(() =&amp;gt; {
    console.log('this happens asynchronously');
  });
});
myEmitter.emit('event', 'a', 'b');

let m = 0;
myEmitter.once('event', () =&amp;gt; {
  console.log(++m);
});
myEmitter.emit('event');
// Prints: 1
myEmitter.emit('event');



myEmitter.emit('error', new Error('whoops!'));

EventEmitterClass.captureRejections = true;
const ee = new EventEmitterClass();
ee.on('something', async (value) =&amp;gt; {
  throw new Error('kaboom');
});

ee.on('error', (err) =&amp;gt; {
    console.error('whoops! there was an error');
  });

ee.emit('something');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>node</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Building a rock-paper-scissor game</title>
      <dc:creator>Muedgar</dc:creator>
      <pubDate>Sun, 17 Jul 2022 22:12:01 +0000</pubDate>
      <link>https://dev.to/muedgar/building-a-rock-paper-scissor-game-l5k</link>
      <guid>https://dev.to/muedgar/building-a-rock-paper-scissor-game-l5k</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
I built a rock-paper-scissor game all on my own and it can be found on the following heroku link:&lt;/p&gt;

&lt;p&gt;I deployed the live program here: &lt;a href="https://edgarprojects.herokuapp.com/two"&gt;rock-paper-scissor&lt;/a&gt;&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>javascript</category>
      <category>express</category>
    </item>
    <item>
      <title>How I demonstrated Growth Mindset recently</title>
      <dc:creator>Muedgar</dc:creator>
      <pubDate>Mon, 02 Sep 2019 14:24:48 +0000</pubDate>
      <link>https://dev.to/muedgar/how-i-demonstrated-growth-mindset-recently-1038</link>
      <guid>https://dev.to/muedgar/how-i-demonstrated-growth-mindset-recently-1038</guid>
      <description>&lt;p&gt;One week ago I became aware how far I was qualified to be able to build the server side part of the app called Free Mentors and I was wondering how I was going to learn server side technologies so fast.On this journey of learning new server side technologies I had first to figure out what I knew and good at, after examining the last projects I have build I figured out that I was good at project management tool called pivotal tracker, git, github, css, html, and javascript.This made it easy for me to learn some of the technologies at hand like node.js which would require good knowledge of javascript.To complete the project's server side part I had to learn node.js, express, eslint, airbnb style guide, mocha, travicci, heroku and coveralls. Having known the knowledge I had to learn it was starting to seem possible.At this point I was attending andela prebootcamp circle 10, which was a good thing because I didn't have to struggle to find the right people to talk to about how I can learn these technologies.And it is in this prebootcamp that they I found the learning materials where I could go and learn on my own so at this point the process was becoming more easier.Immediately I started learning node.js and I exercised on a few core modules (path,fs,...) and latter I express.js. Along the way I had to be on time, so the skill I had to know at a certain time were not the skills I knew, so I faced another problem which was that the task that I was handling was above my present skill level.But I became excited to learn about these technologies even though I didn't have the prerequisite knowledge, I just went and started learning and at the end of the day I had gained something.Now another problem raised because I didn't know how to handle the next challenges because I didn't know how to solve them because I had jumped the content just to learn about the skills which was needed at that time.So at this point I had to level up my skill set on which I had jumped and I found the way of breaking down the learning resource and learn those parts that are very important to get the app working and I focused on those.All of this was possible for me because I knew that I must adapt very fast to the environment even though I haven't yet reached that level.And also I don't fear to dive right in the resources that I have to start learning. When I don't have time to learn from videos or books, then I take someone else code and I learn their code to understand how it works and from there I am able to write my own code. Any time I have a skill gap I see it as a time to stop sleeping a lot and spending my nights acquiring new skills. Along this journey I have survived because of the ability to communicate and ask questions and apply answers I get.Lastly these are the steps I take to have better skills; know what I need to learn, do everything in my power to find people who have those skills, and do exactly every advice they give.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>My experience at andela prebootcamp workshop</title>
      <dc:creator>Muedgar</dc:creator>
      <pubDate>Thu, 29 Aug 2019 12:54:21 +0000</pubDate>
      <link>https://dev.to/muedgar/my-experience-at-andela-prebootcamp-workshop-5hfa</link>
      <guid>https://dev.to/muedgar/my-experience-at-andela-prebootcamp-workshop-5hfa</guid>
      <description>&lt;p&gt;Hello, my name is Mutangana Edgar, I attended the andela prebootcamp workshop of circle 10; and it help me alot with making the adc standardized in pivotal tracker,github workflow,css,js,node,express and postgres. Apart of the prebootcamp there was non technical skills which I also learned, growth mindset,seeking feedback, asking questions and many more other skills. I want to end this short paragraph by thanking all those who prepared this workshop.&lt;/p&gt;

</description>
      <category>webdev</category>
    </item>
  </channel>
</rss>
