envjs at http://www.envjs.com/ is one implementation, I think there may
be others.
Terry
David Parks wrote:
You are correct in that you are wrong about initStandardObjects()
initializing window. :)
window is a DOM object, it specifically references a component of a browser.
As an example that may make this more clear: in my application I execute
javascript on a server, it runs some code that I want to be able to
manipulate dynamically, so running that code as javascript is a good fit. In
my case there is no such concept as a "window". Rhino is only executing the
javascript, not providing any APIs beyond those specified by the language.
You could potentially implement this functionality yourself by exposing an
object called window to the javascript environment. This could be a
reasonably simple object which doesn't really do anything and is just there
to benefit code like this.
I did a quick google search for you and found a reference (which I've never
looked into or know anything about) that seems to suggest there's something
out there that provides an artificial DOM under Rhino. If this is indeed the
case then you could implement this artificial DOM under Rhino to get on with
what you want to do. Here's a lead for you to investigate. Again, I don't
know anything about it, just something for you to read up on and see if it
fits your needs:
http://groups.google.com/group/crosscheck/browse_thread/thread/acfb59defbc9b
f5c
David
-----Original Message-----
From:
dev-tech-js-engine-rhino-bounces+davidparks21=yahoo....@lists.mozilla.org
[mailto:dev-tech-js-engine-rhino-bounces+davidparks21=yahoo....@lists.mozill
a.org] On Behalf Of Garion
Sent: Tuesday, July 13, 2010 8:38 AM
To: [email protected]
Subject: Re: calling javascript API
OK, I think the right method is called evaluateReader and the Reader
parameter is InputStreamReader from the API URLConnection, although now I'm
stuck while evaluating the javascript. In the beginning there are few lines
like
"window.google = windows.google || {};"
from which I get errors like
"ReferenceError: "window" is not defined."
I thought objects like window should be initialized upon calling
initStandardObjects();, but it seems I was probably wrong.
Thanks for your replies,
Garion
Dne Tue, 13 Jul 2010 14:31:43 +0200 Garion <[email protected]> napsal(a):
Hi,
I've tried some basic stuff in Rhino and would like to know if there
is a possibility to call a javascript API. I mean if i would like to
use for example Google Maps JS API, I have to initialize it using
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=set_to_true_or_false"><
/script>
and after that i can make calls to the API in my own script. Is there
any way to make that in Rhino? Like calling this "src" argument. I
figured out it could be something with Context, although after
browsing available methods i didn't find one that would look useful.
Thanks for your replies,
Garion
--
Tato zpráva byla vytvořena převratným poštovním klientem Opery:
http://www.opera.com/mail/
_______________________________________________
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