aboutsummaryrefslogtreecommitdiff
path: root/user-document-templates/montage-application-cloud/main.reel/main.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-15 19:07:31 -0800
committerJose Antonio Marquez2012-02-15 19:07:31 -0800
commitcdd36ed6c789886657c967e72ec2dcd49c6c5a76 (patch)
treeb044208c38770c0c4edce03379071dbf2eb29b83 /user-document-templates/montage-application-cloud/main.reel/main.js
parentc7ef6951baff283266df7567e30c8074dda4ad01 (diff)
parentd366c0bd1af6471511217ed574083e15059519b5 (diff)
downloadninja-cdd36ed6c789886657c967e72ec2dcd49c6c5a76.tar.gz
Merge branch 'refs/heads/NinjaInternal' into FileIO
Conflicts: js/document/html-document.js
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