### Namespace

# JavaScriptCore – 4.1

The JavaScriptCore library

Version | 2.48.6
Authors | The WebKit GTK and WPE teams
License | BSD, LGPL-2.1
Website | https://webkit.org
Source |

#### Build

C headers | `jsc/jsc.h`
pkg-config files | `javascriptcoregtk-4.1`

#### Dependencies

GObject—2.0 | The base type system library
| Browse documentation

#### Additional documentation

- Classes Hierarchy

#### Classes

Class | A JSSClass represents a custom JavaScript class registered by the user in a `JSCContext`. It allows to create new JavaScripts objects whose instances are created by the user using this API. It’s possible to add constructors, properties and methods for a JSSClass by providing `GCallback`s to implement them.
Context | JSCContext represents a JavaScript execution context, where all operations take place and where the values will be associated.
Exception | JSCException represents a JavaScript exception.
Value | JSCValue represents a reference to a value in a `JSCContext`. The JSCValue protects the referenced value from being garbage collected.
VirtualMachine | JSCVirtualMachine represents a group of JSCContexts. It allows concurrent JavaScript execution by creating a different instance of JSCVirtualMachine in each thread.
WeakValue | JSCWeakValue represents a weak reference to a value in a `JSCContext`. It can be used to keep a reference to a JavaScript value without protecting it from being garbage collected and without referencing the `JSCContext` either.

#### Structs

ClassVTable | Virtual table for a JSCClass. This can be optionally used when registering a `JSCClass` in a `JSCContext` to provide a custom implementation for the class. All virtual functions are optional and can be set to `NULL` to fallback to the default implementation.

#### Enumerations

CheckSyntaxMode | Enum values to specify a mode to check for syntax errors in jsc_context_check_syntax().
CheckSyntaxResult | Enum values to specify the result of jsc_context_check_syntax().
OptionType | Enum values for options types. since: 2.24
TypedArrayType | Possible types of the elements contained in a typed array. since: 2.38

#### Bitfields

ValuePropertyFlags | Flags used when defining properties with `jsc_value_object_define_property_data()` and jsc_value_object_define_property_accessor().

#### Callbacks

ClassDeletePropertyFunction | The type of delete_property in `JSCClassVTable`. This is only required when you need to handle external properties not added to the prototype.
ClassEnumeratePropertiesFunction | The type of enumerate_properties in `JSCClassVTable`. This is only required when you need to handle external properties not added to the prototype.
ClassGetPropertyFunction | The type of get_property in `JSCClassVTable`. This is only required when you need to handle external properties not added to the prototype.
ClassHasPropertyFunction | The type of has_property in `JSCClassVTable`. This is only required when you need to handle external properties not added to the prototype.
ClassSetPropertyFunction | The type of set_property in `JSCClassVTable`. This is only required when you need to handle external properties not added to the prototype.
ExceptionHandler | Function used to handle JavaScript exceptions in a `JSCContext`.
Executor | A function passed to `jsc_value_new_promise` called during initialization. since: 2.48
OptionsFunc | Function used to iterate options. since: 2.24

#### Functions

get_major_version | Returns the major version number of the JavaScriptCore library. (e.g. in JavaScriptCore version 1.8.3 this is 1.).
get_micro_version | Returns the micro version number of the JavaScriptCore library. (e.g. in JavaScriptCore version 1.8.3 this is 3.).
get_minor_version | Returns the minor version number of the JavaScriptCore library. (e.g. in JavaScriptCore version 1.8.3 this is 8.).
options_foreach | Iterates all available options calling `function` for each one. Iteration can stop early if `function` returns `FALSE`. since: 2.24
options_get_boolean | Get `option` as a #gboolean value. since: 2.24
options_get_double | Get `option` as a #gdouble value. since: 2.24
options_get_int | Get `option` as a #gint value. since: 2.24

options_get_option_group

Create a `GOptionGroup` to handle JSCOptions as command line arguments. The options will be exposed as command line arguments with the form <emphasis>—jsc-<option>=<value></emphasis>. Each entry in the returned `GOptionGroup` is configured to apply the corresponding option during command line parsing. Applications only need to pass the returned group to g_option_context_add_group(), and the rest will be taken care for automatically.

since: 2.24

options_get_range_string | Get `option` as a range string. The string must be in the format <emphasis>[!]<low>[:<high>]</emphasis> where low and high are #guint values. Values between low and high (both included) will be considered in the range, unless <emphasis>!</emphasis> is used to invert the range. since: 2.24
options_get_size | Get `option` as a #gsize value. since: 2.24
options_get_string | Get `option` as a string. since: 2.24
options_get_uint | Get `option` as a #guint value. since: 2.24
options_set_boolean | Set `option` as a #gboolean value. since: 2.24
options_set_double | Set `option` as a #gdouble value. since: 2.24
options_set_int | Set `option` as a #gint value. since: 2.24
options_set_range_string | Set `option` as a range string. The string must be in the format <emphasis>[!]<low>[:<high>]</emphasis> where low and high are #guint values. Values between low and high (both included) will be considered in the range, unless <emphasis>!</emphasis> is used to invert the range. since: 2.24
options_set_size | Set `option` as a #gsize value. since: 2.24
options_set_string | Set `option` as a string. since: 2.24
options_set_uint | Set `option` as a #guint value. since: 2.24

#### Function Macros

CHECK_VERSION | Check the version of JSC header files at compile time.
DECLARE_FINAL_TYPE |

#### Constants

MAJOR_VERSION | Like jsc_get_major_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.
MICRO_VERSION | Like jsc_get_micro_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.
MINOR_VERSION | Like jsc_get_minor_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.
OPTIONS_USE_DFG | Allows the DFG JIT to be used if `TRUE`. Option type: `JSC_OPTION_BOOLEAN` Default value: `TRUE`.
OPTIONS_USE_FTL | Allows the FTL JIT to be used if `TRUE`. Option type: `JSC_OPTION_BOOLEAN` Default value: `TRUE`.
OPTIONS_USE_JIT | Allows the executable pages to be allocated for JIT and thunks if `TRUE`. Option type: `JSC_OPTION_BOOLEAN` Default value: `TRUE`.
OPTIONS_USE_LLINT | Allows the LLINT to be used if `TRUE`. Option type: `JSC_OPTION_BOOLEAN` Default value: `TRUE`.