From 7ccadc20c96539988290999982d7483e013732f9 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 2 Feb 2012 14:49:34 -0800 Subject: adding a componentController and callback for lazy loading. Signed-off-by: Valerio Virgillito --- .../montage-application-cloud/main.reel/main.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'user-document-templates/montage-application-cloud') 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, { }, addComponentToUserDocument:{ - value:function(containerElement, componentType){ + value:function(containerElement, componentType, callback){ var component = null; switch(componentType.type){ case "Button": - //var tmpFix = require("montage/ui/button.reel"); + //var tmpFix = ("montage/ui/button.reel"); //var str = "montage/ui/button.reel"; var stro = componentType.path; - var button = require(stro); +// var button = (stro); + var button = require.async(stro) + .then(function (button) { + callback(); + }) + .end(); + + /* var buttonInstance = button[componentType.name]; buttonInstance.element = containerElement; @@ -52,6 +59,7 @@ exports.Main = Montage.create(Component, { buttonInstance.label = "Button"; return buttonInstance; + */ break; case "Checkbox": component = Checkbox.create(); -- cgit v1.2.3