static JSObjectRef classConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { PrivateObjectContainer* poc = new PrivateObjectContainer(); JSValueRef val = arguments[0]; JSValueRef val2 = arguments[1]; JSObjectRef objRef = JSValueToObject(ctx, val, NULL); void* raw = JSObjectGetPrivate(objRef); ManipulationHandler_UID^ nobj = (ManipulationHandler_UID^)reinterpret_cast<PrivateObjectContainer*>(raw)->get(); poc->set(nobj); nobj->SetDeltaCallback((int64)JSValueToObject(ctx, val2, NULL)); JSClassDefinition classDefinition = kJSClassDefinitionEmpty; classDefinition.finalize = classDestructor; JSClassRef classDef = JSClassCreate(&classDefinition); return JSObjectMake(ctx, classDef, poc); }
static JSObjectRef classConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { PrivateObjectContainer* poc = new PrivateObjectContainer(); RotateTransform^ nobj = ref new RotateTransform(); poc->set(nobj); JSClassDefinition classDefinition = kJSClassDefinitionEmpty; classDefinition.finalize = classDestructor; JSStaticValue StaticValueArray[] = {{ "Angle", GetAngle, SetAngle, kJSPropertyAttributeNone }, { 0, 0, 0, 0 } }; classDefinition.staticValues = StaticValueArray; JSClassRef clsRef = JSClassCreate(&classDefinition); JSObjectRef classDef = JSObjectMake(ctx, clsRef, poc); return classDef; }