Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(233)

Delta Between Two Patch Sets: app/assets/javascripts/sub-app.js

Issue 7384059: Created Y.SubApp class by extending Y.App
Left Patch Set: Created Y.SubApp class by extending Y.App Created 12 years, 1 month ago
Right Patch Set: Created Y.SubApp class by extending Y.App Created 12 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « app/app.js ('k') | app/modules-debug.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
(...skipping 13 matching lines...) Expand all
24 /** 24 /**
25 Overwrites the core Y.App.Base.navigate method to fire a navigation 25 Overwrites the core Y.App.Base.navigate method to fire a navigation
26 event with details to the parent application. 26 event with details to the parent application.
27 27
28 @method navigate 28 @method navigate
29 @param {string} url the sub apps path. 29 @param {string} url the sub apps path.
30 */ 30 */
31 navigate: function(url, options) { 31 navigate: function(url, options) {
32 this.fire('subNavigate', { 32 this.fire('subNavigate', {
33 url: url, 33 url: url,
34 options: options 34 options: options
bcsaller 2013/02/26 22:01:00 I doubt handling just this is enough to make this
gary.poster 2013/02/26 22:35:45 I appreciate Ben's concern, and this reflects his
jeff.pihach 2013/02/27 05:54:01 I agree that by subclassing app.base we are includ
35 }); 35 });
36 }, 36 },
37 37
38 /** 38 /**
39 Fetches the sub apps routes and adds the namespace to each record. 39 Fetches the sub apps routes and adds the namespace to each record.
40 40
41 @method getSubAppRoutes 41 @method getSubAppRoutes
42 @return {array} routes with namespace. 42 @return {array} routes with namespace.
43 */ 43 */
44 getSubAppRoutes: function() { 44 getSubAppRoutes: function() {
45 var routes = this.get('routes'), 45 var routes = this.get('routes'),
46 namespace = this.get('urlNamespace'), 46 namespace = this.get('urlNamespace'),
47 i; 47 i;
48 48
49 for (i = 0; i < routes.length; i += 1) { 49 Y.Array.each(routes, function(route) {
bcsaller 2013/02/26 22:01:00 We usually use iterators for this.
gary.poster 2013/02/26 22:35:45 +1, unless Jeff has a counter-argument
jeff.pihach 2013/02/27 05:54:01 No counter here - I'll be switching this over
50 routes[i].namespace = namespace; 50 route.namespace = namespace;
51 } 51 });
52 52
53 return routes; 53 return routes;
54 }, 54 },
55 55
56 destructor: function() {} 56 destructor: function() {}
57 57
58 }, { 58 }, {
59 ATTRS: { 59 ATTRS: {
60 /** 60 /**
61 The namespace of the sub-app to update the browser url under. 61 The namespace of the sub-app to update the browser url under.
62 62
63 @attribute urlNamespace 63 @attribute urlNamespace
64 @default undefined 64 @default undefined
65 @type {string} 65 @type {string}
66 */ 66 */
67 urlNamespace: {}, 67 urlNamespace: {}
68
69 /**
70 The SubApp's index location in the registration array.
71
72 @attribute index
73 @default undefined
74 @type {integer}
75 */
76 index: {}
bcsaller 2013/02/26 22:01:00 I think this is unused.
jeff.pihach 2013/02/27 05:54:01 Yes it appears your right, consider it gone!
77 } 68 }
78 }); 69 });
79 70
80 }, '0.1.0', {requires: ['app-base', 'base-build']}); 71 }, '0.1.0', {requires: ['app-base', 'base-build']});
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b