this is the initial update of javascript, the next step would introduce big changes for ...
14 years, 4 months ago
(2009-12-29 10:06:13 UTC)
#2
this is the initial update of javascript,
the next step would introduce big changes for the consistency reason.
please comment on how to port javascript code as small a step as possible.
2009/12/29 <calidion@gmail.com>
> Reviewers: lychen, xan_google.com, weiliu, leio.chen, baiming, qiaojian,
>
> Message:
> javascript update
>
>
>
> Please review this at http://codereview.appspot.com/181091
>
> Affected files:
> A gtfsscheduleviewer/files/data.js
> A gtfsscheduleviewer/files/gtfs.js
> M gtfsscheduleviewer/files/index.html
> M gtfsscheduleviewer/files/route.js
> M gtfsscheduleviewer/files/style.css
> M gtfsscheduleviewer/files/transit_editor.js
> M gtfsscheduleviewer/files/trip.js
> A gtfsscheduleviewer/files/util.js
>
>
>
http://codereview.appspot.com/181091/diff/1/2 File gtfsscheduleviewer/files/data.js (right): http://codereview.appspot.com/181091/diff/1/2#newcode1 gtfsscheduleviewer/files/data.js:1: (function(gtfs){ Very curious why you use namespace in this ...
14 years, 4 months ago
(2009-12-29 11:04:50 UTC)
#3
http://codereview.appspot.com/181091/diff/1/2
File gtfsscheduleviewer/files/data.js (right):
http://codereview.appspot.com/181091/diff/1/2#newcode1
gtfsscheduleviewer/files/data.js:1: (function(gtfs){
Very curious why you use namespace in this way, that embrace all the definitions
in a function then assign them to to parameter "gtfs".
Here the only benefit I can see is you can use shortcuts in the code, just as
you do for "$", "Select", etc. Is there any other specific reasons?
Anyway, I think it is not the typical Javascript way to use namespace. The more
common style is
gtfs.data = {};
gtfs.Base = function() {
this.fetcher = new gtfs.util.rpc.Fetcher; // Use the full namespace path
};
gtfs.Base.prototype.foo = function() {
// or make shortcuts in a particular function body
var Select = gtfs.util.dom.Select;
var s = new Select();
};
For things like "$" that are used very widely, you can make the shortcut after
where you define gtfs.util.dom.byId, that can be used all over the code, not
only this file.
Also, using the wrapping function is hard to understand, especially to those who
are not as familiar with Javascript as you.
Issue 181091: localize functions into namespaces
Created 14 years, 4 months ago by calidion
Modified 7 years, 4 months ago
Reviewers: lychen, xan_google.com, weiliu, leio.chen, baiming, qiaojian
Base URL: http://scheduleeditor.googlecode.com/svn/trunk/python/
Comments: 1