Create a function in context
.
If name
is null an anonymous function will be created. When the function is called by
JavaScript or jsc_value_function_call
, callback
is called receiving an GenericArray
of Value<!-- -->s with the arguments and then user_data
as last parameter.
When the function is cleared in context
, destroy_notify
is called with user_data
as parameter.
Note that the value returned by callback
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.
context |
a Context |
name |
the function name or null |
callback | |
return_type |
the Type of the function return value, or g_type_none if the function is void. |
destroy_notify |
destroy notifier for |
user_data |
user data to pass to |
a Value. |