This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

modularization in java script

 
Trilochan Bharadwaj
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have something like this in jsDir/nms.js:

And then i have a jsDir/nms/aop/nms-aop.js with:



How do i use nms-aop.js's NMS.AOP module inside of NMS in nms.js ...? Any thoughts, inputs?

Trilochan


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't. That style of script is specifically geared towards making things self-contained and unshareable. You'll need to do something to make the functions you want to use externally visible, or change the way that they're declared in the first place.
 
Trilochan Bharadwaj
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.I don't have the svn snapshot for Dojo, but I basically wanted to do something like: dojo.require( "dijit.widget.*"); within NMS namespace; and then allow it to be used throughout my different JS modules ... like NMS.require( " " );, my question is more geared towards providing me with conceptual understanding or snippet of how that can be done ...

Any pointers?
 
Trilochan Bharadwaj
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, Just for follow up, I got around the problem by doing something like:



I know there is a better way of doing it (I am thinking that we provide a file path name in a.b.c form and then traverse through folders to get the URI and then do an eval on the js file to get hold of object hierarchy ... I'll give that a try too, but I thought this was easy enough to do.

Trilochan.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic