Modularized app using AMD, where to find examples??

Discussion created by DMS2 on Dec 17, 2013
Latest reply on Dec 18, 2013 by JUihlein-esristaff
Hi everyone!
I have very little experience with Javascript but I've sort of managed to start upgrading an app from Javascript API 2.1 to 3.7 using AMD and HTML5 compatibility.

Right now the only things I'm working with are a map with a custom toolbar which are initialized before showing anything when the app is loading (so when the app is shown all buttons and the map are loaded, for visualization purposes).
It works so far but I'm still unsure about some concepts though and I only find simple non-modularized examples which use AMD and are HTML5 compatible.

My old app has an HTML main file and 4 js files. The HTML file has minimal Javascript and the idea is to keep it like this. The js files are referenced like this inside the HTML:
    <script src="js/basic.js"></script>
    <script src="js/Config.js"></script>
    <script src="js/arcgis.js"></script>
    <script src="js/myApp.js"></script>

Some variables created in one js are called from other js files, for example, my map and toolbars are created in arcgis.js but for some functions they are used in myApp.js.

Now I've realized that I can't keep on doing things like this because of the require() way of working. So I've come to the conclusion that I should create classes, but I've been 2 whole days trying to do so and reading he API and Dojo documentation and my app is not working and I'm sure it's because there's too many things I haven't understood properly. I've never built a class before so it's all very new to me.

The only thing I need to start with and to understand how it all works is a simple modularized app using AMD with the map and draw/navigation toolbars created in a module (in a class?) and with a function initializing them from another module. And also see how to call that function from the HTML file before my divs and buttons are created (inside the body div I guess).
Any simple example or a reference to a site where I can find them is really welcome! Thank you so much!