diff options
author | Nivesh Rajbhandari | 2012-05-04 14:54:35 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-05-04 14:54:35 -0700 |
commit | ce2d581894f9e433a7b73e4b622352a657b6ddaa (patch) | |
tree | bbd4eb9f6d00ee9d3c0bcc53ce560cfc1e71127b /js/document/templates/montage-web/main.js | |
parent | 8f8f7f9a36fb9abadea2a9f25aef0084946bebc9 (diff) | |
parent | 8dcbac5d4c30e9dfbc543a5f997939111e9c9f89 (diff) | |
download | ninja-ce2d581894f9e433a7b73e4b622352a657b6ddaa.tar.gz |
Merge branch 'refs/heads/dom-architecture-master' into Dom-Architecture
Conflicts:
js/document/templates/montage-web/default_html.css
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/document/templates/montage-web/main.js')
-rw-r--r-- | js/document/templates/montage-web/main.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/js/document/templates/montage-web/main.js b/js/document/templates/montage-web/main.js new file mode 100644 index 00000000..d5ac88d5 --- /dev/null +++ b/js/document/templates/montage-web/main.js | |||
@@ -0,0 +1,49 @@ | |||
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> */ | ||
6 | var Montage = require("montage/core/core").Montage, | ||
7 | Component = require("montage/ui/component").Component; | ||
8 | |||
9 | exports.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 | var self = this; | ||
21 | window.addComponent = function(element, data, callback) { | ||
22 | var component; | ||
23 | |||
24 | component = require.async(data.path) | ||
25 | .then(function(component) { | ||
26 | var componentRequire = component[data.name]; | ||
27 | var componentInstance = componentRequire.create(); | ||
28 | |||
29 | componentInstance.element = element; | ||
30 | |||
31 | componentInstance.needsDraw = true; | ||
32 | componentInstance.ownerComponent = self; | ||
33 | |||
34 | callback(componentInstance, element); | ||
35 | }) | ||
36 | .end(); | ||
37 | |||
38 | }; | ||
39 | |||
40 | // Dispatch event when this template has loaded. | ||
41 | /* | ||
42 | var newEvent = document.createEvent( "CustomEvent" ); | ||
43 | newEvent.initCustomEvent( "userTemplateDidLoad", false, true ); | ||
44 | document.body.dispatchEvent( newEvent ); | ||
45 | */ | ||
46 | |||
47 | } | ||
48 | } | ||
49 | }); \ No newline at end of file | ||