If you have a handle to an object you can add a c++ function to the
prototype like this:

object->GetPrototype()->Set(
  String::New("Name_Of_Function"),
  FunctionTemplate::New(pointer_to_c++_function));

If you want to add the function with the implementation being handled
in javascript then you could do something along these lines:

Script::Compile(String::New("Object.prototype.myFunc = function ()
{ ... }"))->Run();



Corey

On Oct 12, 5:35 pm, Florent Steiner <[EMAIL PROTECTED]> wrote:
> Wow, I'm totaly lost, there.
>
> I would like to extend the Object prototype like this :
>
> Object.prototype.myFunc = function () {
> ...
>
> }
>
> But I don't know how to do so in C++ :(
>
> Could somebody help me ?
>
> Regards,
> Florent Steiner
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to