On Mon, Jun 7, 2010 at 4:45 PM, Martin Cohen <[email protected]>wrote:
> m_instances.insert( std::make_pair( object, js_object ) ); > // Set the internal field value to the C++ object > js_object->SetInternalField( 0, v8::External::New( object ) ); > return js_object; > ... > However a returned object has no class name set, so the "instanceof" > operator does not work. From what I've learned, the "instanceof" > operator works using the object.prototype.constructor property, though > I'm not sure how to correctly set it up in this wrap function. > If you want to skip a lot of trial and error, and jump right into your coding, i strongly recommend using one of the several 3rd-party libs which take care of those bits for you. A partial list (the ones i know about): http://code.google.com/p/v8-juice (that one's mine! :) http://nodejs.org/ http://code.google.com/p/cproxyv8/ http://code.google.com/p/v8cgi/ Slapping a single class binding together isn't too much work (once you've done it a few times), but if you want to bind more than a couple classes, a generic framework for doing so is in order. The above libraries provide such features, each with varying strengths and weaknesses. -- ----- stephan beal http://wanderinghorse.net/home/stephan/ -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
