Method

JavaScriptCoreContextevaluate_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

Type: const char*

A JavaScript script to evaluate.

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

Type: gssize

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

object_instance

Type: gpointer

An object instance.

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

Type: JSCClass

A JSCClass or NULL to use the default.

The argument can be NULL.
The data is owned by the caller of the method.
uri

Type: const char*

The source URI.

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

Type: guint

The starting line number.

object

Type: JSCValue

Return location for a JSCValue.

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

Return value

Type: JSCValue

A JSCValue representing the last value generated by the script.

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