<?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: mpisau</title>
    <description>The latest articles on DEV Community by mpisau (@sardello).</description>
    <link>https://dev.to/sardello</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%2F1264180%2F9f92827b-e3bc-46bf-acca-2785aac815c0.png</url>
      <title>DEV Community: mpisau</title>
      <link>https://dev.to/sardello</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sardello"/>
    <language>en</language>
    <item>
      <title>Modules in Javascript. Comprehension problems. When and where to outsource what</title>
      <dc:creator>mpisau</dc:creator>
      <pubDate>Fri, 08 Mar 2024 10:39:10 +0000</pubDate>
      <link>https://dev.to/sardello/modules-in-javascript-comprehension-problems-when-and-where-to-outsource-what-1fho</link>
      <guid>https://dev.to/sardello/modules-in-javascript-comprehension-problems-when-and-where-to-outsource-what-1fho</guid>
      <description>&lt;p&gt;Hello. I need help using modules. I have attached the app.js as a module in my single page application.&lt;/p&gt;

&lt;p&gt;There is a loadContent function in app.js. This should regenerate the content of  depending on the URL parameters or the menu item clicked.&lt;/p&gt;

&lt;p&gt;For example, if I click on the Map menu item, the map.js module is imported and the showMap function it contains is called.&lt;/p&gt;

&lt;p&gt;However, additional links are created in the showMap function, which in turn should call the loadContent function when clicked.&lt;/p&gt;

&lt;p&gt;However, map.js does not know this function because it is defined in app.js.&lt;/p&gt;

&lt;p&gt;What would be best practice here? Add the event handlers after the function call showMap in the app.js? Or outsource the loadContent as module and import it everywhere? Or is my approach completely wrong?&lt;/p&gt;

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