Skip to content

Commit

Permalink
feat(app generator): start app only on DOM ready-ness
Browse files Browse the repository at this point in the history
Finalize app section and remaining documentation.
  • Loading branch information
cueedee committed Apr 13, 2015
1 parent b3c00dd commit 0d302df
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 22 deletions.
44 changes: 34 additions & 10 deletions generators/app/templates/demo/_app.coffee
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
###*<% if ( packageDescription ) { %>
#
# <%= packageDescription %><% } %>
#
# @module App
#
###

##
## Declare and load app pre-requisites, then start.
##

## ============================================================================
##
## [Q]
Expand Down Expand Up @@ -158,17 +170,29 @@ settings = require( 'madlib-settings' )
locale = require( 'madlib-locale' )


router = require( './router.coffee' )
## ============================================================================
##
## [App]
##

router = require( './router.coffee' )

## Initialize locale passing Handlebars runtime and default locale.
## It's loading the locale file async so wait starting the app until that's done.
##
locale.initialize( Handlebars, 'en_GB' ).done(

# Initialize locale passing Handlebars runtime and default locale
# it's loading the locale file async so wait starting the app until
# that's done.
#
locale.initialize( Handlebars, 'en_GB' ).then(
() ->
# Start your application here
#
router.startApp()

## Start the app when the DOM is ready.
##
$( () ->

router.startApp()

return

)

return

Expand All @@ -177,4 +201,4 @@ locale.initialize( Handlebars, 'en_GB' ).then(

return

).done()
)
52 changes: 40 additions & 12 deletions generators/app/templates/src/_app.coffee
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
###*<% if ( packageDescription ) { %>
#
# <%= packageDescription %><% } %>
#
# @module App
#
###

##
## Declare and load app pre-requisites, then start.
##

## ============================================================================
##
## [Q]
Expand Down Expand Up @@ -158,15 +170,29 @@ settings = require( 'madlib-settings' )
locale = require( 'madlib-locale' )<% } %>


router = require( './router.coffee' )
## ============================================================================
##
## [App]
##

#<% if ( i18n ) { %>
router = require( './router.coffee' )<% if ( i18n ) { %>

## Initialize locale passing Handlebars runtime and default locale.
## It's loading the locale file async so wait starting the app until that's done.
##
locale.initialize( Handlebars, 'en_GB' ).done(

locale.initialize( Handlebars, 'en_GB' ).then(
() ->
# Start your application here
#
router.startApp()

## Start the app when the DOM is ready.
##
$( () ->

router.startApp()

return

)

return

Expand All @@ -175,12 +201,14 @@ locale.initialize( Handlebars, 'en_GB' ).then(

return

).done()
)<% } else { %>

## Start the app when the DOM is ready.
##
$( () ->

#<% } else { %>
router.startApp()

# Start your application here
#
router.startApp()
return

#<% } %>
)<% } %>

0 comments on commit 0d302df

Please sign in to comment.