object_define_property_accessor


Description:

public void object_define_property_accessor (string property_name, ValuePropertyFlags flags, Type property_type, Callback? getter, Callback? setter, void* user_data, DestroyNotify? destroy_notify)

Define or modify a property with property_name in object referenced by this.

When the property value needs to be getted or set, getter and setter callbacks will be called. When the property is cleared in the Class context, destroy_notify is called with user_data as parameter. This is equivalent to JavaScript <function>Object.defineProperty()</function> when used with an accessor descriptor.

Note that the value returned by getter must be fully transferred. In case of boxed types, you could use g_type_pointer instead of the actual boxed Type to ensure that the instance owned by Class is used. If you really want to return a new copy of the boxed type, use JSC_TYPE_VALUE and return a Value created with Value.object that receives the copy as instance parameter.

Parameters:

this

a Value

property_name

the name of the property to define

flags

ValuePropertyFlags

property_type

the Type of the property

getter

a ObjectConstructorFunc to be called to get the property value

setter

a ObjectConstructorFunc to be called to set the property value

destroy_notify

destroy notifier for user_data

user_data

user data to pass to getter and setter