I am starting to explore the use of requirejs and developing modular
javascript code. What I am looking for is somefeed back on the style
and maybe some suggested improvements as to how I currently define my
modules.
//example module
define([ 'core/view/AppView',
'jquery'],function(AppView){
return function ThisNewModule(){
//check for use of new!
if (!(this instanceof ThisNewModule)) {
return new ThisNewModule();
}
var me = {},
privateVar = true,
privateFunction = function(data){
//do cool private stuff
},
view = new AppView();
me.publicVar = false;
me.publicFunction = function(data){
privateVar = false;
privateFunction(data);
view.add(data);
};
return me;
};
});
Any feedback would be great! Thanks!
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]