Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Context.enter() for every execution

1 view
Skip to first unread message

chrislewis

unread,
Mar 1, 2007, 11:11:33 PM3/1/07
to
Hello all,

I'm new to rhino and have started implementing it as the scripting
core for a Java Swing application. I'm curious about interaction with
the engine, specifically how I should invoke script execution.
Currently i'm using it to bind menu clicks to JS calls, to provide a
flexible ui. Each click results in a Context.enter() call, execution,
and Context.exit(). Note that I only call initStandardObjects() once -
during application initialization - since this is an expensive call.
But what about Context.enter()? Is it expensive? Or is calling it
frequently inconsequential?

Thanks!

Attila Szegedi

unread,
Mar 6, 2007, 3:30:07 AM3/6/07
to chrislewis, dev-tech-...@lists.mozilla.org
You're doing it correctly. Yes, you need to do
Context.enter()/Context.exit(), but they're not really expensive.
Initializing the standard objects once is okay provided you reuse that
scope, which you can do, just take care to not write scripts that tamper
with standard objects :-)

Attila.

On Fri, 02 Mar 2007 04:11:33 -0000, chrislewis <burning...@gmail.com>
wrote:

chrislewis

unread,
Mar 7, 2007, 9:25:16 AM3/7/07
to
On Mar 6, 3:30 am, "Attila Szegedi" <szege...@freemail.hu> wrote:
> You're doing it correctly. Yes, you need to do
> Context.enter()/Context.exit(), but they're not really expensive.
> Initializing the standard objects once is okay provided you reuse that
> scope, which you can do, just take care to not write scripts that tamper
> with standard objects :-)
>
> Attila.
>
> On Fri, 02 Mar 2007 04:11:33 -0000, chrislewis <burningodzi...@gmail.com>

> wrote:
>
> > Hello all,
>
> > I'm new to rhino and have started implementing it as the scripting
> > core for a Java Swing application. I'm curious about interaction with
> > the engine, specifically how I should invoke script execution.
> > Currently i'm using it to bind menu clicks to JS calls, to provide a
> > flexible ui. Each click results in a Context.enter() call, execution,
> > and Context.exit(). Note that I only call initStandardObjects() once -
> > during application initialization - since this is an expensive call.
> > But what about Context.enter()? Is it expensive? Or is calling it
> > frequently inconsequential?
>
> > Thanks!

Attila,

Thanks!

0 new messages