add_method
Description:
public void add_method (string name, owned ClassMethodCb callback, Type return_type)
Add method with name to this.
When the method is called by JavaScript or jsc_value_object_invoke_method, callback is called receiving the class
instance as first parameter, followed by a GenericArray of
Value<!-- -->s with the method arguments and then user_data
as last parameter. When the method is cleared in the Class context,
destroy_notify is called with user_data as parameter.
Note that the value returned by callback must be transfer full. In case of non-refcounted boxed types, you should 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 the instance parameter.
Parameters:
| this |
a Class |
| name |
the method name |
| callback |
a ClassSetPropertyCb to be called to invoke method
|
| return_type |
the Type of the method return value, or g_type_none if the method is void. |
| destroy_notify |
destroy notifier for |
| user_data |
user data to pass to |