In the book "Structuring Backbone Code with RequireJS and Marionette Modules" by Sulc D. there is a code:
define(["app", "apps/config/storage/localstorage"], function(ContactManager){
ContactManager.module("Entities", function(Entities, ContactManager, Backbone, Marionette, $, _){
Entities.Contact = Backbone.Model.extend({
urlRoot: "contacts",
.....
ContactManage is a backbone.Marionette app instance
var ContactManager = new Marionette.Application();
For waht I know from requirejs documentation, we should define dependencies in ["app", "ContactManager"...] and pass App and ContactManager in function(App, ContactManager ...), but in the above code ContactManager is passed to function, but it is not defined as a dependency. Why is it so?
Please, also explain, what this code does:
ContactManager.module("Entities", function(Entities, ContactManager, Backbone, Marionette, $, _){
Why should we create a requirejs module? Thanks!!!
code is available in guthub https://github.com/davidsulc/structuring-backbone-with-requirejs-and-marionette