Method

WPEJavaScriptCoreContextevaluate_in_object

Declaration [src]

JSCValue*
jsc_context_evaluate_in_object (
  JSCContext* context,
  const char* code,
  gssize length,
  gpointer object_instance,
  JSCClass* object_class,
  const char* uri,
  guint line_number,
  JSCValue** object
)

Description [src]

Evaluate code and create an new object where symbols defined in code will be added as properties, instead of being added to context global object. The new object is returned as object parameter. Similar to how jsc_value_new_object() works, if object_instance is not NULL object_class must be provided too. The line_number is the starting line number in uri; the value is one-based so the first line is 1. uri and line_number will be shown in exceptions and they don’t affect the behavior of the script.

Parameters

code const char*
 

A JavaScript script to evaluate.

 The data is owned by the caller of the function.
 The value is a NUL terminated UTF-8 string.
length gssize
 

Length of code, or -1 if code is a nul-terminated string.

object_instance gpointer
 

An object instance.

 The argument can be NULL.
 The data is owned by the caller of the function.
object_class JSCClass
 

A JSCClass or NULL to use the default.

 The argument can be NULL.
 The data is owned by the caller of the function.
uri const char*
 

The source URI.

 The data is owned by the caller of the function.
 The value is a NUL terminated UTF-8 string.
line_number guint
 

The starting line number.

object JSCValue
 

Return location for a JSCValue.

 The argument will be set by the function.
 The instance takes ownership of the data, and is responsible for freeing it.

Return value

Returns: JSCValue
 

A JSCValue representing the last value generated by the script.

 The caller of the method takes ownership of the data, and is responsible for freeing it.