This contains a folder with two sub-folders and one file. It also
app/assets/js/app/app.js- contains theAppobject. It makes functions like initView(), initComponents(), and reinitComponents() availableapp/assets/js/app/components/- contatains reusable components only. I don't plan subdirectories.app/assets/js/app/views/- contains page-specific code. also contains what might be called "page-specific components. copies the directory structure of theapp/viewslike in railsapp/assets/js/manifest.js- concatenates all javascript files in the following order:app/assets/js/app/app.js- containsAppobject- javascript libraries, manually arranged according to the dependencies of each
app/assets/js/app/components/folder treeapp/assets/js/app/viewsfolder tree- a small bit of code in
app/assets/js/manifest.jsto initialize the components and a view through theAppobject
This contains the pages to be displayed, and the layouts.
All components are initialized all at once.
On every page load, jQuery binds event listeners to elements with [data-app-component], whether the element exists or not
(I did this this so that it might work better with turbolinks in the future). This components may also create and trigger
custom events. Once an event is triggered, the component activates its code.