Skip to content

Commit

Permalink
feat(app generator): add 'open' event, triggered when router loads (o…
Browse files Browse the repository at this point in the history
…r re-renders) a view
  • Loading branch information
cueedee committed Apr 13, 2015
1 parent 7e5f845 commit 39f1662
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions generators/app/templates/demo/router.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,18 @@
@$mainContent.append( @pageView.render( params ).$el )


###*
# Signal loading of the `@$mainContent` container with a view.
#
# @event open
#
# @param {Backbone.View} view The view instance currently loaded.
# @param {Object} params A key-value mapping of the matched route's url pattern's parameters.
#
###

@trigger( 'open', @pageView, params )

return


Expand Down
12 changes: 12 additions & 0 deletions generators/app/templates/src/_router.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,18 @@
@$mainContent.append( @pageView.render( params ).$el )


###*
# Signal loading of the `@$mainContent` container with a view.
#
# @event open
#
# @param {Backbone.View} view The view instance currently loaded.
# @param {Object} params A key-value mapping of the matched route's url pattern's parameters.
#
###

@trigger( 'open', @pageView, params )

return

#<% if ( i18n ) { %>
Expand Down

0 comments on commit 39f1662

Please sign in to comment.