Great - Thanks Kevin! On Dec 30 2008, 6:38 pm, "Ruland Kevin-BHP637" <[email protected]> wrote: > Ok, that didn't work but this does: > > Scriptable scope = cx.initStandardObjects(); > NativeJavaPackage p = new NativeJavaPackage("foo.bar"); > p.setParentScope( scope ); > scope.put("bar", scope, p ); > > This does use the deprecated constructor for NativeJavaPackage, but there is > a three argument constructor which is not deprecated. > > Kevin > > > > -----Original Message----- > From: dev-tech-js-engine-rhino-bounces+kruland=motorola....@lists.mozilla.org > [mailto:dev-tech-js-engine-rhino-bounces+kruland=motorola....@lists.mozilla.org] > On Behalf Of Ruland Kevin-BHP637 > Sent: Tuesday, December 30, 2008 8:34 AM > To: Jani; [email protected] > Subject: RE: Shortening Java package names for JavaScript > > Yes, you can do this. After you create your scriptable and > initStandardObjects in it, you can do this: > > scriptable.put( "bar", scriptable, Context.newObject(scriptable, > "Packages.foo.bar", null ) ); > > Kevin > > -----Original Message----- > From: dev-tech-js-engine-rhino-bounces+kruland=motorola....@lists.mozilla.org > [mailto:dev-tech-js-engine-rhino-bounces+kruland=motorola....@lists.mozilla.org] > On Behalf Of Jani > Sent: Tuesday, December 30, 2008 3:55 AM > To: [email protected] > Subject: Re: Shortening Java package names for JavaScript > > Yeah that's what I'm doing. I have a JS file which initializes a bunch of > variables like that, but I was wondering if I could just do that in Java. > > Thanks anyways =) > > On Dec 29, 11:18 pm, Tom Robinson <[email protected]> wrote: > > On Dec 28, 4:13 pm, Jani <[email protected]> wrote: > > I think you can just do "var bar = Packages.foo.bar;", if I correctly > > understand what you're trying to do. > > > > Hi > > > > I've been trying to find out a good way to provide a specific set of > > > Java classes to JavaScript. > > > > Basically, I would like to do something like show Packages.foo.bar.* > > > as bar.* in JS side of things. So far I've been just using a quick > > > JS snippet to manually map the long namespace into the shorter one. > > > > I've gone through the docs and examples a few times and can't really > > > find a way to do this any easier. > > > > Thanks in advance for any ideas. > > _______________________________________________ > dev-tech-js-engine-rhino mailing list > [email protected]https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino > _______________________________________________ > dev-tech-js-engine-rhino mailing list > [email protected]https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
_______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
