Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split Namespace Declaration from Application Entry Point #42

Merged
merged 4 commits into from Jan 23, 2012

Conversation

kurtmilam
Copy link
Contributor

Putting these in two separate files (index.js = namespace declaration, app.js = app entry point) and changing load order to:
app/index.js
app/modules/*.js
app/app.js

makes for a more flexible solution that allows the app to be initialized on some event other than jQuery(document).ready()

This is helpful, for instance, for jquery mobile projects, where the app may need to be initialized before jQuery(document).ready() fires.

See here for more info: azicchetti/jquerymobile-router#12 (comment)

kurtmilam and others added 2 commits January 23, 2012 23:17
Splitting these into two files and controlling their load order makes the
boilerplate more flexible by allowing entry to be bound to something other
than jQuery(function($){ . This is useful for jquery mobile projects, for
instance.
@tbranyen
Copy link
Owner

Hrm perhaps naming the namespace file, namespace.js and keeping index.js the same sans the namespace definition. I'm doing this in the amd branch now.

See previous commit message for more details.
@kurtmilam
Copy link
Contributor Author

That'd be fine - I'm new to git. Used to working with hg / Mercurial. Left a couple of files out of this commit. Will try to make my next pull request a little cleaner :-)

Namespace is defined in app/namespace.js, app init is defined in index.js.
Load order in index.html and build/config.js were changed to:
app/namespace.js
app/modules/*.js
app/index.js
@kurtmilam
Copy link
Contributor Author

I believe this second go-around is cleaner. Files are named as you requested.

@tbranyen
Copy link
Owner

Looks good, thanks man!

tbranyen added a commit that referenced this pull request Jan 23, 2012
Split Namespace Declaration from Application Entry Point
@tbranyen tbranyen merged commit f200981 into tbranyen:master Jan 23, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants