Value.function_variadic


Description:

[ CCode ( has_construct_function = false ) ]
public Value.function_variadic (Context context, string? name, Callback callback, void* user_data, DestroyNotify? destroy_notify, Type return_type)

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.

Parameters:

context

a Context

name

the function name or null

callback

a ClassSetPropertyCb.

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

user data to pass to callback.

Returns:

a Value.




2022 vala-language.org