I'm building an JSObjectRef with both static functions and property variables, but I found that if I define the class like this:
static JSStaticFunction myStaticFunctions[] = {
{ "myStFunc", JSAction::jsMyStFunc, kJSPropertyAttributeNone },
{ 0, 0, 0 }
};
JSClassDefinition classDef = kJSClassDefinitionEmpty;
classDef.staticFunctions = myStaticFunctions;
classDef.getProperty = jsPropertyGet;
jsclass = JSClassCreate(&classDef);
proto = JSObjectMake(cx, jsclass, NULL);
And when I'm calling the static function(myStFunc) in javascript, the getProperty callback(jsPropertyGet) is also invoked, but I don't know how to return the default action.
Okay I got it.
for JSObjectGetPropertyCallback, return NULL
will get the request forwards to it's static properties, then parent class chain, and then prototype chain.
for JSObjectSetPropertyCallback, return false
if you don't want to process it by yourself.