0

I'm developing an application with this structure

  • App
    • Pages
      • Profile
      • Account
      • etc...
    • Modules
      • nameOfModule
      • nameOfModule
      • etc

In the Pages directory I've got all the different pages in the application, switching between these pages will cause reloads.

In each of these pages directories, for example Profile, I've got 3 files(may differ)

  • router.js
  • main.js
  • app.js

main.js is called using requireJS and the only thing it does in set some paths for the dependencies and then it just calls the initialize() located in app.js wich in turn simply initializes the router in router.js.

My problem is, how and where do I connect the modules to the actual page? Lets say I've got a few modules that are supposed to show up on the Profile page, lets call them Module1, Module2 and Module3, where do I organize these modules for the page?

It feels wrong to organize these kind of things in the router? Where do I decide wich modules I use and where they go?

4

1 回答 1

0

您可以考虑使用木偶模块来帮助您

https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.application.module.md#starting-and-stopping-modules

于 2013-06-12T15:31:55.113 回答