diff options
author | Valerio Virgillito | 2012-02-02 14:49:34 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-02 14:49:34 -0800 |
commit | 7ccadc20c96539988290999982d7483e013732f9 (patch) | |
tree | 4f39a9086cad6155ea86e63e1d0f43479b70bd8b /user-document-templates | |
parent | 49b15e69f18a9d9748f703092725a3c8df7fc698 (diff) | |
download | ninja-7ccadc20c96539988290999982d7483e013732f9.tar.gz |
adding a componentController and callback for lazy loading.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'user-document-templates')
-rw-r--r-- | user-document-templates/montage-application-cloud/main.reel/main.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/user-document-templates/montage-application-cloud/main.reel/main.js b/user-document-templates/montage-application-cloud/main.reel/main.js index 415794d8..036d6c24 100644 --- a/user-document-templates/montage-application-cloud/main.reel/main.js +++ b/user-document-templates/montage-application-cloud/main.reel/main.js | |||
@@ -32,17 +32,24 @@ exports.Main = Montage.create(Component, { | |||
32 | }, | 32 | }, |
33 | 33 | ||
34 | addComponentToUserDocument:{ | 34 | addComponentToUserDocument:{ |
35 | value:function(containerElement, componentType){ | 35 | value:function(containerElement, componentType, callback){ |
36 | var component = null; | 36 | var component = null; |
37 | switch(componentType.type){ | 37 | switch(componentType.type){ |
38 | case "Button": | 38 | case "Button": |
39 | 39 | ||
40 | //var tmpFix = require("montage/ui/button.reel"); | 40 | //var tmpFix = ("montage/ui/button.reel"); |
41 | //var str = "montage/ui/button.reel"; | 41 | //var str = "montage/ui/button.reel"; |
42 | var stro = componentType.path; | 42 | var stro = componentType.path; |
43 | 43 | ||
44 | var button = require(stro); | 44 | // var button = (stro); |
45 | 45 | ||
46 | var button = require.async(stro) | ||
47 | .then(function (button) { | ||
48 | callback(); | ||
49 | }) | ||
50 | .end(); | ||
51 | |||
52 | /* | ||
46 | var buttonInstance = button[componentType.name]; | 53 | var buttonInstance = button[componentType.name]; |
47 | 54 | ||
48 | buttonInstance.element = containerElement; | 55 | buttonInstance.element = containerElement; |
@@ -52,6 +59,7 @@ exports.Main = Montage.create(Component, { | |||
52 | buttonInstance.label = "Button"; | 59 | buttonInstance.label = "Button"; |
53 | 60 | ||
54 | return buttonInstance; | 61 | return buttonInstance; |
62 | */ | ||
55 | break; | 63 | break; |
56 | case "Checkbox": | 64 | case "Checkbox": |
57 | component = Checkbox.create(); | 65 | component = Checkbox.create(); |