tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject git commit: Change the main export of t5/core/pageinit to be the function to perform full-page initialization
Date Wed, 26 Dec 2012 22:21:49 GMT
Updated Branches:
  refs/heads/master dea2df879 -> 5e624ae65


Change the main export of t5/core/pageinit to be  the function to perform full-page initialization


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

Branch: refs/heads/master
Commit: 5e624ae65d6ef512034bda0090c9b4e7206f49bc
Parents: dea2df8
Author: Howard M. Lewis Ship <hlship@apache.org>
Authored: Wed Dec 26 14:21:44 2012 -0800
Committer: Howard M. Lewis Ship <hlship@apache.org>
Committed: Wed Dec 26 14:21:44 2012 -0800

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/pageinit.coffee       |   37 ++++++++-------
 .../resources/org/apache/tapestry5/core.properties |    4 +-
 2 files changed, 21 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5e624ae6/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/pageinit.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/pageinit.coffee
b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/pageinit.coffee
index e37e765..f9f6799 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/pageinit.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/pageinit.coffee
@@ -105,7 +105,26 @@ define ["_", "./console", "./dom", "./events"],
 
         tracker()
 
-    exports =
+    # Loads all specified libraries in order (this includes other the core stack, other stacks,
and
+    # any free-standing libraries). It then executes the initializations. Once all initializations
have
+    # completed (which is usually an asynchronous operation, as initializations may require
the loading
+    # of further modules), then the `data-page-initialized` attribute of the root HTML element
is set to
+    # 'true'.
+    #
+    # This is the main export of the module; other functions are attached as properties.
+    loadLibrariesAndInitialize = (libraries, inits) ->
+      console.debug "Loading #{libraries?.length or 0} libraries"
+      exports.loadLibraries libraries,
+        -> exports.initialize inits,
+          ->
+            # At this point, all libraries have been loaded, and all inits should have executed.
Unless some of
+            # the inits triggered Ajax updates (such as a core/ProgressiveDisplay component),
then the page should
+            # be ready to go. We set a flag, mostly used by test suites, to ensure that all
is ready.
+            # Note that later Ajax requests do not change this attribute, so their timing
continues to be tricky.
+
+            (dom document.documentElement).attribute "data-page-initialized", "true"
+
+    exports = _.extend loadLibrariesAndInitialize,
       # 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) ->
@@ -146,22 +165,6 @@ define ["_", "./console", "./dom", "./events"],
 
         finalCallback.call null
 
-      # Loads all specified libraries in order (this includes other the core stack, other
stacks, and
-      # any free-standing libraries). It then executes the immediate initializations. After
that, it waits for the DOM to be
-      # 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, inits) ->
-        console.debug "Loading #{libraries?.length or 0} libraries"
-        exports.loadLibraries libraries,
-          -> exports.initialize inits,
-            ->
-              # At this point, all libraries have been loaded, and all inits should have
executed. Unless some of
-              # the inits triggered Ajax updates (such as a core/ProgressiveDisplay component),
then the page should
-              # be ready to go. We set a flag, mostly used by test suites, to ensure that
all is ready.
-              # Note that later Ajax requests do not change this attribute, so their timing
continues to be tricky.
-
-              (dom document.documentElement).attribute "data-page-initialized", "true"
-
       evalJavaScript: (js) ->
         console.debug "Evaluating: #{js}"
         eval js

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/5e624ae6/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties b/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties
index e5ec3b0..cda4b4a 100644
--- a/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties
+++ b/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties
@@ -49,9 +49,7 @@ required=You must provide a value for %s.
 private-no-validation-for-field=placeholder message
 
 core-page-initialization-template=\
-require(["t5/core/pageinit"], function(pageinit) {\
-  pageinit.loadLibrariesAndInitialize(%s, %s); \
-});
+require(["t5/core/pageinit"], function(pi) { pi(%s, %s); });
 
 # Default values for selected core component parameters.
 


Mime
View raw message