From c58dc96130c7eb5d964af53e9ad6e80bba5e647f Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 18 Apr 2012 17:24:40 -0700 Subject: initial stage web template Signed-off-by: Valerio Virgillito --- .../templates/montage-web/main.reel/main.js | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 js/document/templates/montage-web/main.reel/main.js (limited to 'js/document/templates/montage-web/main.reel/main.js') diff --git a/js/document/templates/montage-web/main.reel/main.js b/js/document/templates/montage-web/main.reel/main.js new file mode 100644 index 00000000..019c675e --- /dev/null +++ b/js/document/templates/montage-web/main.reel/main.js @@ -0,0 +1,48 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component; + +exports.Main = Montage.create(Component, { + + hasTemplate: { + value: false + }, + + /** + * Adding window hooks to callback into this object from Ninja. + */ + templateDidLoad: { + value: function(){ + var self = this; + window.addComponent = function(element, data, callback) { + var component; + + component = require.async(data.path) + .then(function(component) { + var componentRequire = component[data.name]; + var componentInstance = componentRequire.create(); + + componentInstance.element = element; + + componentInstance.needsDraw = true; + componentInstance.ownerComponent = self; + + callback(componentInstance, element); + }) + .end(); + + }; + + // Dispatch event when this template has loaded. + var newEvent = document.createEvent( "CustomEvent" ); + newEvent.initCustomEvent( "userTemplateDidLoad", false, true ); + + document.body.dispatchEvent( newEvent ); + + } + } +}); \ No newline at end of file -- cgit v1.2.3