I'm going to be calling a class constant method in Javascript like so:

Camera.setActive(value);


The value should be an instance of Camera. In the accessor function,
how can I find out if the parameter is of type Camera? This is what I
have so far:

v8::Handle<v8::Value> jsi_Camera_setActive(const v8::Arguments& args)
{
        // Validate the arguments.
        if (args.Length() != 1) {
                std::stringstream ss;
                ss << "Camera.setActive() takes one argument. ";
                ss << args.Length();
                ss << " arguments passed in.";
                return v8::ThrowException(v8::String::New(ss.str().c_str(), 
ss.str
().length()));
        }

        v8::Local<v8::Object> camera = args[0];

        // Make sure we have an object.
        if (!camera->IsObject()) {
                std::stringstream ss;
                ss << "Camera.setActive()'s argument must be of type [object
Camera].";
                return v8::ThrowException(v8::String::New(ss.str().c_str(), 
ss.str
().length()));
        }

        // TODO: find out if the variable is of type Camera.


        return v8::True();
}



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

Reply via email to