You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2012/10/25 23:41:59 UTC

[5/13] git commit: Add more debugging information when executing initializations

Add more debugging information when executing initializations


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/02e6f740
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/02e6f740
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/02e6f740

Branch: refs/heads/5.4-js-rewrite
Commit: 02e6f74083365777b7170efe6d85fcd0055cb823
Parents: aa24d4b
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Thu Oct 25 11:50:33 2012 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Thu Oct 25 11:50:33 2012 -0700

----------------------------------------------------------------------
 .../META-INF/modules/core/pageinit.coffee          |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/02e6f740/tapestry-core/src/main/coffeescript/META-INF/modules/core/pageinit.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/core/pageinit.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/core/pageinit.coffee
index 57ebc26..ef55d5e 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/core/pageinit.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/core/pageinit.coffee
@@ -105,6 +105,7 @@ define ["_", "core/console", "core/spi", "core/events"],
       # Passed a list of initializers, executes each initializer in order. Due to asynchronous loading
       # of modules, the exact order in which initializer functions are invoked is not predictable.
       initialize: (inits = [], callback) ->
+        console.debug "Executing #{inits.length} inits"
         callbackCountdown = inits.length + 1
 
         # tracker gets invoked once after each require/callback, plus once extra
@@ -113,8 +114,9 @@ define ["_", "core/console", "core/spi", "core/events"],
         tracker = ->
           callbackCountdown--
 
-          if callbackCountdown is 0 and callback
-            callback()
+          if callbackCountdown is 0
+            console.debug "Inits completed"
+            callback() if callback
 
         # First value in each init is the qualified module name; anything after
         # that are arguments to be passed to the identified function.
@@ -139,10 +141,14 @@ define ["_", "core/console", "core/spi", "core/events"],
       # ready (which, given typical Tapestry page structure, it almost certainly is at the point this function
       # executed), and then executes the other initializations.
       loadLibrariesAndInitialize: (libraries, immediateInits, otherInits) ->
+        console.debug "Loading #{libraries?.length or 0} libraries"
         exports.loadLibraries libraries, ->
+          console.debug "Executing immediate inits"
           exports.initialize immediateInits
 
-          spi.domReady -> exports.initialize otherInits
+          spi.domReady ->
+            console.debug "Executing ordinary inits"
+            exports.initialize otherInits
 
       evalJavaScript: (js) ->
         console.debug "Evaluating: #{js}"