I can't answer your first question, but

> Questions #2 is, I'm trying to think of a way to be able to include a
> javascript file in another. I would create some global function, say
> include(), that includes and compiles a requested file. This is some
> example code of how I see it working.
>
(snip)
>
> The issue is, v8::Script::Run() executes the code and performs
> callbacks, but I'm not familiar with a way to sort of 'pause' the
> current script when the include() function is called, execute the
> other script, and the continue with the execution as before the
> include() function was called.
>
> I would appreciate some words about how to go about implementing such
> an include.

This is pretty trivial.
You don't have to 'pause' anything if you implement it as a regular
method (which I would personally recommend).
Any method call can be seen as "pausing" the calling method, until returning.

I have code like this:

Handle<Value> LoadScript(const char* file) { /* load, compile, and run
script */ }

Handle<Value> js_load(const Arguments& args) { return
LoadScript(*String::AsciiValue(args[0])); }

And then you just have to make js_load available as a global function
in your context. :-)

- Simon

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to