I suck.

This is a question I had asked before:

http://groups.google.com/group/v8-users/browse_thread/thread/0ab5fefdb4b31b22

On Jan 11, 6:50 am, vlad <[email protected]> wrote:
> I haven't found the proper way to get/set static variables for
> Javascript functions that will be used as classes. For instance, I
> want to have a Javascript class, Mouse, that has 2 static variables:
>
> log(Mouse.x);
> Mouse.y = 25;
>
> This is how it would be done for *instances* of the Mouse class in C+
> +:
> --------------
> v8::Handle<v8::FunctionTemplate> functionTpl =
> v8::FunctionTemplate::New(constructorFunction);
> v8::Handle<v8::ObjectTemplate>       instanceTpl = functionTpl-
>
> >InstanceTemplate();
>
> instanceTpl->SetAccessor(v8::String::New("x"), getX, setX);
> instanceTpl->SetAccessor(v8::String::New("Y"), getY, setY);
> --------------------
>
> But I don't want to create instances of the Mouse class, since there
> is only one mouse. What's the code needed to set and get properties of
> the class, not the instances?
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to