Hello
I am trying to use v8 to add functions and variables to already
existing C++ objects.
Having tried numerous variations, I have come up with this (which
still does not work):
- one shared context for the entire application
- objects are wrapped with a function constructor
- this is added to the global object with Set(..)
- each object gets a unique name
- a script is compiled:
attribute0 = new Attribute0(); // the wrapped object
attribute0.test = function()
{
this.a = 1; // a is a value added with SetAccessor(..)
}
attribute0;
- script is compiled using Compile
- script is run using Run and return object is stored in Persistent
object
- function test is called, but the "a" accessor is not called.
- same with functions, regardless if I add them to the template or the
instance in the function constructor
What I am trying to make is something akin the DOM in the browser,
with the difference that the objects themselves add their functions
(via their own script), instead of adding from outside the DOM.
This difference should not in itself be the problem, I guess Im
missing some basic understanding of javascript, v8 or both.
Any help would be appreciated.
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users