aboutsummaryrefslogtreecommitdiff
path: root/user-document-templates/montage-application-cloud/main.reel/main.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-14 11:22:21 -0800
committerValerio Virgillito2012-02-14 11:22:21 -0800
commitab1466b2627e40f58afcaa3d425d4145fa47525a (patch)
tree5c0de8b4db67b07b0e745e776e99eabff989d804 /user-document-templates/montage-application-cloud/main.reel/main.js
parent33c805d441abb2f83fd1ac9ee2d3d4282acc009f (diff)
parentdf898049b2990f456a305eb18434b887468225cf (diff)
downloadninja-ab1466b2627e40f58afcaa3d425d4145fa47525a.tar.gz
Merge branch 'components' of https://github.com/mencio/ninja-internal into integration
Conflicts: js/io/document/html-document.js Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'user-document-templates/montage-application-cloud/main.reel/main.js')
-rw-r--r--user-document-templates/montage-application-cloud/main.reel/main.js55
1 files changed, 55 insertions, 0 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
new file mode 100644
index 00000000..86871fd3
--- /dev/null
+++ b/user-document-templates/montage-application-cloud/main.reel/main.js
@@ -0,0 +1,55 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */
6var Montage = require("montage/core/core").Montage,
7 Component = require("montage/ui/component").Component;
8
9//var Button = ("montage/ui/button.reel").Button;
10
11exports.Main = Montage.create(Component, {
12
13 hasTemplate: {
14 value: false
15 },
16
17 /**
18 * Adding window hooks to callback into this object from Ninja.
19 */
20 templateDidLoad: {
21 value: function(){
22 window.addComponent = this.addComponentToUserDocument;
23// window.addBinding = this.addBindingToUserDocument;
24
25 // Dispatch event when this template has loaded.
26 var newEvent = document.createEvent( "CustomEvent" );
27 newEvent.initCustomEvent( "userTemplateDidLoad", false, true );
28
29 document.body.dispatchEvent( newEvent );
30
31 }
32 },
33
34 addComponentToUserDocument:{
35 value:function(element, data, callback){
36
37 var component;
38
39 component = require.async(data.path)
40 .then(function(component) {
41 var componentRequire = component[data.name];
42 var componentInstance = componentRequire.create();
43
44 componentInstance.element = element;
45 componentInstance.deserializedFromTemplate();
46 componentInstance.needsDraw = true;
47
48 callback(componentInstance, element);
49 })
50 .end();
51
52 }
53 }
54
55}); \ No newline at end of file