Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 YUI.add('sub-app', function(Y) { | 3 YUI.add('sub-app', function(Y) { |
4 | 4 |
5 /** | 5 /** |
6 Base class to create sub apps. | 6 Base class to create sub apps. |
7 | 7 |
8 A Y.SubApp has the same API as Y.App with a few key differences: | 8 A Y.SubApp has the same API as Y.App with a few key differences: |
9 Routes are pulled into the parent application on registration | 9 Routes are pulled into the parent application on registration |
10 Navigation calls are dispatched to the parent | 10 Navigation calls are dispatched to the parent |
11 | 11 |
12 @module sub-app | 12 @module sub-app |
13 @class SubApp | 13 @class SubApp |
14 @namespace juju | 14 @namespace juju |
15 */ | 15 */ |
16 var SubApp = Y.Base.create('sub-app', Y.App.Base, [], { | 16 var SubApp = Y.Base.create('sub-app', Y.App.Base, [], { |
17 | 17 |
18 initializer: function() { | 18 initializer: function() { |
19 this.publish('subNavigate', { | 19 this.publish('subNavigate', { |
20 emitFacade: true | 20 emitFacade: true |
21 }); | 21 }); |
22 }, | 22 }, |
23 | 23 |
24 /* | 24 /* |
25 Middleware that is called on every namespaced path to ensure that the | 25 Middleware that is called on every namespaced path to ensure that the |
26 sub app is rendered before calling any other callbacks | 26 sub app is rendered before calling any other callbacks |
27 | 27 |
28 @method _checkRendered | 28 @method verifyRendered |
29 @protected | |
30 */ | 29 */ |
31 _checkRendered: function() { | 30 verifyRendered: function() { |
gary.poster
2013/02/28 22:43:02
not really protected, yeah?
matthew.scott
2013/02/28 23:08:57
Curious about the name. 'checkRendered' makes me
jeff.pihach
2013/02/28 23:27:27
Yeah you're right this isn't really protected I'll
| |
32 if (this.get('rendered') === false) { | 31 if (this.get('rendered') === false) { |
33 this.render(); | 32 this.render(); |
34 } | 33 } |
35 }, | 34 }, |
36 | 35 |
37 /** | 36 /** |
38 Overwrites the core Y.App.Base.navigate method to fire a navigation | 37 Overwrites the core Y.App.Base.navigate method to fire a navigation |
39 event with details to the parent application. | 38 event with details to the parent application. |
40 | 39 |
41 @method navigate | 40 @method navigate |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 */ | 98 */ |
100 rendered: { | 99 rendered: { |
101 value: false | 100 value: false |
102 } | 101 } |
103 } | 102 } |
104 }); | 103 }); |
105 | 104 |
106 Y.namespace('juju').SubApp = SubApp; | 105 Y.namespace('juju').SubApp = SubApp; |
107 | 106 |
108 }, '0.1.0', {requires: ['app-base', 'base-build']}); | 107 }, '0.1.0', {requires: ['app-base', 'base-build']}); |
LEFT | RIGHT |