From 19aca6ec6f3c10922646f0ca760a375acdffaf56 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 21 Mar 2012 16:35:20 -0700 Subject: Adding 'addComponentFirstDraw' event from the user document main component. Signed-off-by: Valerio Virgillito --- js/document/templates/montage-html/main.reel/main.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'js/document/templates') diff --git a/js/document/templates/montage-html/main.reel/main.js b/js/document/templates/montage-html/main.reel/main.js index 6c141108..2970f37a 100644 --- a/js/document/templates/montage-html/main.reel/main.js +++ b/js/document/templates/montage-html/main.reel/main.js @@ -27,16 +27,17 @@ exports.Main = Montage.create(Component, { var componentInstance = componentRequire.create(); componentInstance.element = element; - //componentInstance.deserializedFromTemplate(); + componentInstance.needsDraw = true; componentInstance.ownerComponent = self; + componentInstance.addEventListener("firstDraw", self, false); + callback(componentInstance, element); }) .end(); }; -// window.addBinding = this.addBindingToUserDocument; // Dispatch event when this template has loaded. var newEvent = document.createEvent( "CustomEvent" ); @@ -45,5 +46,14 @@ exports.Main = Montage.create(Component, { document.body.dispatchEvent( newEvent ); } + }, + + handleFirstDraw: { + value: function() { + var newEvent = document.createEvent( "CustomEvent" ); + newEvent.initCustomEvent( "addComponentFirstDraw", false, true ); + + document.body.dispatchEvent( newEvent ); + } } }); \ No newline at end of file -- cgit v1.2.3