Method
JavaScriptCoreClassadd_property
Declaration [src]
void
jsc_class_add_property (
JSCClass* jsc_class,
const char* name,
GType property_type,
GCallback getter,
GCallback setter,
gpointer user_data,
GDestroyNotify destroy_notify
)
Description [src]
Add a property with name to jsc_class. When the property value needs to be getted, getter is called
receiving the the class instance as first parameter and user_data as last parameter. When the property
value needs to be set, setter is called receiving the the class instance as first parameter, followed
by the value to be set and then user_data as the last parameter. When the property is cleared in the
JSCClass context, destroy_notify is called with user_data as parameter.
Note that the value returned by getter must be transfer full. In case of non-refcounted boxed types, you should use
G_TYPE_POINTER instead of the actual boxed GType to ensure that the instance owned by JSCClass is used.
If you really want to return a new copy of the boxed type, use #JSC_TYPE_VALUE and return a JSCValue created with jsc_value_new_object() that receives the copy as the instance parameter.
Parameters
name-
Type:
const char*The property name.
The data is owned by the caller of the method. The value is a NUL terminated UTF-8 string. property_type-
Type:
GTypeThe
GTypeof the property value. getter-
Type:
GCallbackA
GCallbackto be called to get the property value.The argument can be NULL. setter-
Type:
GCallbackA
GCallbackto be called to set the property value.The argument can be NULL. user_data-
Type:
gpointerUser data to pass to
getterandsetter.The argument can be NULL.The data is owned by the caller of the method. destroy_notify-
Type:
GDestroyNotifyDestroy notifier for
user_data.The argument can be NULL.