aboutsummaryrefslogtreecommitdiff
path: root/js/document/templates/montage-html/main.reel
diff options
context:
space:
mode:
authorPushkar Joshi2012-02-24 12:08:49 -0800
committerPushkar Joshi2012-02-24 12:08:49 -0800
commit03ca7a5ed13c25faaa9100bb666e062fd15335e6 (patch)
treec51112223ceb9121cd595a60335eb2795215590f /js/document/templates/montage-html/main.reel
parentfcb12cc09eb3cd3b42bd215877ba18f449275b75 (diff)
parent053fc63a2950c7a5ee4ebf98033b64d474a3c46e (diff)
downloadninja-03ca7a5ed13c25faaa9100bb666e062fd15335e6.tar.gz
Merge branch 'pentool' into brushtool
Conflicts: imports/codemirror/mode/scheme/scheme.js js/tools/BrushTool.js
Diffstat (limited to 'js/document/templates/montage-html/main.reel')
-rw-r--r--js/document/templates/montage-html/main.reel/main.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/js/document/templates/montage-html/main.reel/main.js b/js/document/templates/montage-html/main.reel/main.js
new file mode 100644
index 00000000..567f481c
--- /dev/null
+++ b/js/document/templates/montage-html/main.reel/main.js
@@ -0,0 +1,54 @@
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
9exports.Main = Montage.create(Component, {
10
11 hasTemplate: {
12 value: false
13 },
14
15 /**
16 * Adding window hooks to callback into this object from Ninja.
17 */
18 templateDidLoad: {
19 value: function(){
20 window.addComponent = this.addComponentToUserDocument;
21// window.addBinding = this.addBindingToUserDocument;
22
23 // Dispatch event when this template has loaded.
24 var newEvent = document.createEvent( "CustomEvent" );
25 newEvent.initCustomEvent( "userTemplateDidLoad", false, true );
26
27 document.body.dispatchEvent( newEvent );
28
29 }
30 },
31
32 // Adding components to the user document by using a async require.
33 addComponentToUserDocument:{
34 value:function(element, data, callback){
35
36 var component;
37
38 component = require.async(data.path)
39 .then(function(component) {
40 var componentRequire = component[data.name];
41 var componentInstance = componentRequire.create();
42
43 componentInstance.element = element;
44 //componentInstance.deserializedFromTemplate();
45 componentInstance.needsDraw = true;
46
47 callback(componentInstance, element);
48 })
49 .end();
50
51 }
52 }
53
54}); \ No newline at end of file