Re: Is possible to include js file into another js file?
Hi Ivana, What I do is combine Rhino with Velocity. So a get a script and use Velocity like a pre-processor. So I have code like this: // Some script. var hello = 10; #include(/common/StringUtil.js) The #include is a velocity macro which inserts the other js file into the current one. Usually I would place these at the bottom of the js file. If you haven't used Velocity there is good documentation here: http://velocity.apache.org/ On 5/23/2010 12:22 PM, Ivana wrote: Hi, I need to define variables and functions in one javascript file, and than include this file into another javascript file and use them. Is that possible (even if is needed to use java interface)? Thank you a lot. Ivana ___ dev-tech-js-engine-rhino mailing list dev-tech-js-engine-rhino@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
Re: Is possible to include js file into another js file?
On Sun, May 23, 2010 at 12:22 PM, Ivana iva.supal...@gmail.com wrote: Hi, I need to define variables and functions in one javascript file, and than include this file into another javascript file and use them. Is that possible (even if is needed to use java interface)? I use an approach similar to Dan's however I'd like to replace it with require. There's been some work done here to support the require() function, I don't know much of the details, maybe someone else here can cover it. -- Daryl Stultz _ 6 Degrees Software and Consulting, Inc. http://www.6degrees.com http://www.opentempo.com mailto:daryl.stu...@opentempo.com ___ dev-tech-js-engine-rhino mailing list dev-tech-js-engine-rhino@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
Re: Is possible to include js file into another js file?
You can use Rhino's CommonJS support by implementing org.mozilla.javascript.commonjs.module.Require, which can be done inside JS. I am using this in Myna[1] and you can see how I'm doing it here[2]. Basically you need to let Rhino know how to resolve CommonJS classpaths, and it takes care of the rest. Note: Rhino's CommonJS support is only implemented in CVS right now, so you'll need to build from CVS. if you are feeling lazy you can grab my js.jar build from [3]. [1]:http://www.mynajs.org [2]:http://code.google.com/p/myna/source/browse/trunk/1.0/web/shared/ js/libOO/CommonJS.sjs?spec=svn109r=109 [3]:http://myna.googlecode.com/svn-history/r109/trunk/1.0/jars/js.jar -- Mark Porter Myna JavaScript Application Server Easy server-side JS on a Java platform http://www.mynajs.org On May 24, 6:18 am, Daryl Stultz da...@6degrees.com wrote: On Sun, May 23, 2010 at 12:22 PM, Ivana iva.supal...@gmail.com wrote: Hi, I need to define variables and functions in one javascript file, and than include this file into another javascript file and use them. Is that possible (even if is needed to use java interface)? I use an approach similar to Dan's however I'd like to replace it with require. There's been some work done here to support the require() function, I don't know much of the details, maybe someone else here can cover it. -- Daryl Stultz _ 6 Degrees Software and Consulting, Inc.http://www.6degrees.comhttp://www.opentempo.com mailto:daryl.stu...@opentempo.com ___ dev-tech-js-engine-rhino mailing list dev-tech-js-engine-rhino@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino