From 8fe92b94ce5e1e2857d088752d94e19db7e3d8a8 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Sun, 17 Jun 2012 22:31:44 -0700 Subject: montage v11 merge into ninja Signed-off-by: Valerio Virgillito --- node_modules/montage/ui/application.js | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'node_modules/montage/ui/application.js') diff --git a/node_modules/montage/ui/application.js b/node_modules/montage/ui/application.js index bbce6835..025ef950 100755 --- a/node_modules/montage/ui/application.js +++ b/node_modules/montage/ui/application.js @@ -137,28 +137,27 @@ var Application = exports.Application = Montage.create(Montage, /** @lends monta value: null }, - /** - Description TODO - @function - @param {Function} callback A function to invoke after the method has completed. - */ - load: { - value: function(callback) { - var template = Template.create().initWithDocument(window.document), - component, + _load: { + value: function(applicationRequire, callback) { + var template = Template.create().initWithDocument(window.document, applicationRequire), + rootComponent, self = this; - self = Application.isPrototypeOf(self) ? self : Application.create(); - // assign to the exports so that it is available in the deserialization of the template exports.application = self; - template.instantiateWithOwnerAndDocument(null, window.document, function() { - require("ui/component").__root__.needsDraw = true; - if (callback) { - callback(self); - } - }); + require.async("ui/component").then(function(exports) { + rootComponent = exports.__root__; + rootComponent.element = document; + template.instantiateWithOwnerAndDocument(null, window.document, function() { + self.callDelegateMethod("willFinishLoading", self); + rootComponent.needsDraw = true; + if (callback) { + callback(self); + } + + }); + }).end(); } }, -- cgit v1.2.3