Hello all, I echo everyones congrats on such a wonderful piece of software.
I have 2 questions. First, in this thread: http://groups.google.com/group/v8-users/browse_thread/thread/482575a1186e8cba# a user mentions about saving persistent scripts. I'm having an issue adding a persitent script object as a member of a class. It looks something like this: ---------------------------------------------------------------------------- #include <v8.h> namespace v8 { class Script; template <class T> Handle <class Y>; // ... or however this is declared in v8.h template<class T> Persistent<class Y>; // ... or however this is declared in v8.h } namespace foobar{ class SomeClass { public: v8::Persistent<v8::Script> _script; SomeClass * factory(std::string& file); private: SomeClass(v8::Handle<v8::Script> script); }; } // namespace ---------------------------------------------------------------------------- The compiler doesn't like the line 'v8::Persistent<v8::Script> _script;'. I can't recall the exact error message, but it was complaining about Persistent not being a known type. Sorry I'm not at my computer right now. The point is, can a compiled script live as a member of a class like that? 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. ---------------------------------------------- function foo(file) { if (file != undefined) { include(file); // The javascript included is executed here, with the scope of the function foo(). // If the file has function definitions, the definitions are available globally. // After the file up top finishes executing, continue here. print("Included script: " + file); } } foo("cool_script.js"); ---------------------------------------------- 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. Regards, ~vlad --~--~---------~--~----~------------~-------~--~----~ v8-users mailing list [email protected] http://groups.google.com/group/v8-users -~----------~----~----~----~------~----~------~--~---
